mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 22:26:06 +00:00
MachMessageServer: Make request messages const.
There’s no reason that “in” or “request” messages should be non-const. This makes them const, bridges the const gap left by the MIG-generated “check” functions with wrappers, and uses non-const fields in “out” messages instead of const fields in “in” messages for in-out parameters. TEST=util_test ExcServerVariants.*:MachMessageServer.* R=rsesek@chromium.org Review URL: https://codereview.chromium.org/564533002
This commit is contained in:
parent
a01c87059b
commit
fbf12950fe
@ -143,6 +143,58 @@ enum MachMessageID : mach_msg_id_t {
|
|||||||
kMachMessageIDMachExceptionRaiseStateIdentity = 2407,
|
kMachMessageIDMachExceptionRaiseStateIdentity = 2407,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The MIG-generated __MIG_check__Request__*() functions are not declared as
|
||||||
|
// accepting const data, but they could have been because they in fact do not
|
||||||
|
// modify the data. These wrapper functions are provided to bridge the const gap
|
||||||
|
// between the code in this file, which is const-correct and treats request
|
||||||
|
// message data as const, and those generated functions.
|
||||||
|
|
||||||
|
kern_return_t MIGCheckRequestExceptionRaise(
|
||||||
|
const __Request__exception_raise_t* in_request) {
|
||||||
|
typedef __Request__exception_raise_t Request;
|
||||||
|
return __MIG_check__Request__exception_raise_t(
|
||||||
|
const_cast<Request*>(in_request));
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_return_t MIGCheckRequestExceptionRaiseState(
|
||||||
|
const __Request__exception_raise_state_t* in_request,
|
||||||
|
const __Request__exception_raise_state_t** in_request_1) {
|
||||||
|
typedef __Request__exception_raise_state_t Request;
|
||||||
|
return __MIG_check__Request__exception_raise_state_t(
|
||||||
|
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_return_t MIGCheckRequestExceptionRaiseStateIdentity(
|
||||||
|
const __Request__exception_raise_state_identity_t* in_request,
|
||||||
|
const __Request__exception_raise_state_identity_t** in_request_1) {
|
||||||
|
typedef __Request__exception_raise_state_identity_t Request;
|
||||||
|
return __MIG_check__Request__exception_raise_state_identity_t(
|
||||||
|
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_return_t MIGCheckRequestMachExceptionRaise(
|
||||||
|
const __Request__mach_exception_raise_t* in_request) {
|
||||||
|
typedef __Request__mach_exception_raise_t Request;
|
||||||
|
return __MIG_check__Request__mach_exception_raise_t(
|
||||||
|
const_cast<Request*>(in_request));
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_return_t MIGCheckRequestMachExceptionRaiseState(
|
||||||
|
const __Request__mach_exception_raise_state_t* in_request,
|
||||||
|
const __Request__mach_exception_raise_state_t** in_request_1) {
|
||||||
|
typedef __Request__mach_exception_raise_state_t Request;
|
||||||
|
return __MIG_check__Request__mach_exception_raise_state_t(
|
||||||
|
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
|
||||||
|
}
|
||||||
|
|
||||||
|
kern_return_t MIGCheckRequestMachExceptionRaiseStateIdentity(
|
||||||
|
const __Request__mach_exception_raise_state_identity_t* in_request,
|
||||||
|
const __Request__mach_exception_raise_state_identity_t** in_request_1) {
|
||||||
|
typedef __Request__mach_exception_raise_state_identity_t Request;
|
||||||
|
return __MIG_check__Request__mach_exception_raise_state_identity_t(
|
||||||
|
const_cast<Request*>(in_request), const_cast<Request**>(in_request_1));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -153,7 +205,7 @@ ExcServer::ExcServer(ExcServer::Interface* interface)
|
|||||||
interface_(interface) {
|
interface_(interface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
bool ExcServer::MachMessageServerFunction(const mach_msg_header_t* in_header,
|
||||||
mach_msg_header_t* out_header,
|
mach_msg_header_t* out_header,
|
||||||
bool* destroy_complex_request) {
|
bool* destroy_complex_request) {
|
||||||
PrepareReplyFromRequest(in_header, out_header);
|
PrepareReplyFromRequest(in_header, out_header);
|
||||||
@ -162,8 +214,8 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
case kMachMessageIDExceptionRaise: {
|
case kMachMessageIDExceptionRaise: {
|
||||||
// exception_raise(), catch_exception_raise().
|
// exception_raise(), catch_exception_raise().
|
||||||
typedef __Request__exception_raise_t Request;
|
typedef __Request__exception_raise_t Request;
|
||||||
Request* in_request = reinterpret_cast<Request*>(in_header);
|
const Request* in_request = reinterpret_cast<const Request*>(in_header);
|
||||||
kern_return_t kr = __MIG_check__Request__exception_raise_t(in_request);
|
kern_return_t kr = MIGCheckRequestExceptionRaise(in_request);
|
||||||
if (kr != MACH_MSG_SUCCESS) {
|
if (kr != MACH_MSG_SUCCESS) {
|
||||||
SetReplyError(out_header, kr);
|
SetReplyError(out_header, kr);
|
||||||
return true;
|
return true;
|
||||||
@ -190,12 +242,12 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
case kMachMessageIDExceptionRaiseState: {
|
case kMachMessageIDExceptionRaiseState: {
|
||||||
// exception_raise_state(), catch_exception_raise_state().
|
// exception_raise_state(), catch_exception_raise_state().
|
||||||
typedef __Request__exception_raise_state_t Request;
|
typedef __Request__exception_raise_state_t Request;
|
||||||
Request* in_request = reinterpret_cast<Request*>(in_header);
|
const Request* in_request = reinterpret_cast<const Request*>(in_header);
|
||||||
|
|
||||||
// in_request_1 is used for the portion of the request after the codes,
|
// in_request_1 is used for the portion of the request after the codes,
|
||||||
// which in theory can be variable-length. The check function will set it.
|
// which in theory can be variable-length. The check function will set it.
|
||||||
Request* in_request_1;
|
const Request* in_request_1;
|
||||||
kern_return_t kr = __MIG_check__Request__exception_raise_state_t(
|
kern_return_t kr = MIGCheckRequestExceptionRaiseState(
|
||||||
in_request, &in_request_1);
|
in_request, &in_request_1);
|
||||||
if (kr != MACH_MSG_SUCCESS) {
|
if (kr != MACH_MSG_SUCCESS) {
|
||||||
SetReplyError(out_header, kr);
|
SetReplyError(out_header, kr);
|
||||||
@ -204,13 +256,14 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
|
|
||||||
typedef __Reply__exception_raise_state_t Reply;
|
typedef __Reply__exception_raise_state_t Reply;
|
||||||
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
||||||
|
out_reply->flavor = in_request_1->flavor;
|
||||||
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
||||||
out_reply->RetCode =
|
out_reply->RetCode =
|
||||||
interface_->CatchExceptionRaiseState(in_header->msgh_local_port,
|
interface_->CatchExceptionRaiseState(in_header->msgh_local_port,
|
||||||
in_request->exception,
|
in_request->exception,
|
||||||
in_request->code,
|
in_request->code,
|
||||||
in_request->codeCnt,
|
in_request->codeCnt,
|
||||||
&in_request_1->flavor,
|
&out_reply->flavor,
|
||||||
in_request_1->old_state,
|
in_request_1->old_state,
|
||||||
in_request_1->old_stateCnt,
|
in_request_1->old_stateCnt,
|
||||||
out_reply->new_state,
|
out_reply->new_state,
|
||||||
@ -219,7 +272,6 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_reply->flavor = in_request_1->flavor;
|
|
||||||
out_header->msgh_size =
|
out_header->msgh_size =
|
||||||
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
||||||
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
||||||
@ -230,12 +282,12 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
// exception_raise_state_identity(),
|
// exception_raise_state_identity(),
|
||||||
// catch_exception_raise_state_identity().
|
// catch_exception_raise_state_identity().
|
||||||
typedef __Request__exception_raise_state_identity_t Request;
|
typedef __Request__exception_raise_state_identity_t Request;
|
||||||
Request* in_request = reinterpret_cast<Request*>(in_header);
|
const Request* in_request = reinterpret_cast<const Request*>(in_header);
|
||||||
|
|
||||||
// in_request_1 is used for the portion of the request after the codes,
|
// in_request_1 is used for the portion of the request after the codes,
|
||||||
// which in theory can be variable-length. The check function will set it.
|
// which in theory can be variable-length. The check function will set it.
|
||||||
Request* in_request_1;
|
const Request* in_request_1;
|
||||||
kern_return_t kr = __MIG_check__Request__exception_raise_state_identity_t(
|
kern_return_t kr = MIGCheckRequestExceptionRaiseStateIdentity(
|
||||||
in_request, &in_request_1);
|
in_request, &in_request_1);
|
||||||
if (kr != MACH_MSG_SUCCESS) {
|
if (kr != MACH_MSG_SUCCESS) {
|
||||||
SetReplyError(out_header, kr);
|
SetReplyError(out_header, kr);
|
||||||
@ -244,6 +296,7 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
|
|
||||||
typedef __Reply__exception_raise_state_identity_t Reply;
|
typedef __Reply__exception_raise_state_identity_t Reply;
|
||||||
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
||||||
|
out_reply->flavor = in_request_1->flavor;
|
||||||
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
||||||
out_reply->RetCode = interface_->CatchExceptionRaiseStateIdentity(
|
out_reply->RetCode = interface_->CatchExceptionRaiseStateIdentity(
|
||||||
in_header->msgh_local_port,
|
in_header->msgh_local_port,
|
||||||
@ -252,7 +305,7 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
in_request->exception,
|
in_request->exception,
|
||||||
in_request->code,
|
in_request->code,
|
||||||
in_request->codeCnt,
|
in_request->codeCnt,
|
||||||
&in_request_1->flavor,
|
&out_reply->flavor,
|
||||||
in_request_1->old_state,
|
in_request_1->old_state,
|
||||||
in_request_1->old_stateCnt,
|
in_request_1->old_stateCnt,
|
||||||
out_reply->new_state,
|
out_reply->new_state,
|
||||||
@ -262,7 +315,6 @@ bool ExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_reply->flavor = in_request_1->flavor;
|
|
||||||
out_header->msgh_size =
|
out_header->msgh_size =
|
||||||
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
||||||
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
||||||
@ -287,7 +339,8 @@ MachExcServer::MachExcServer(MachExcServer::Interface* interface)
|
|||||||
interface_(interface) {
|
interface_(interface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
bool MachExcServer::MachMessageServerFunction(
|
||||||
|
const mach_msg_header_t* in_header,
|
||||||
mach_msg_header_t* out_header,
|
mach_msg_header_t* out_header,
|
||||||
bool* destroy_complex_request) {
|
bool* destroy_complex_request) {
|
||||||
PrepareReplyFromRequest(in_header, out_header);
|
PrepareReplyFromRequest(in_header, out_header);
|
||||||
@ -296,9 +349,8 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
case kMachMessageIDMachExceptionRaise: {
|
case kMachMessageIDMachExceptionRaise: {
|
||||||
// mach_exception_raise(), catch_mach_exception_raise().
|
// mach_exception_raise(), catch_mach_exception_raise().
|
||||||
typedef __Request__mach_exception_raise_t Request;
|
typedef __Request__mach_exception_raise_t Request;
|
||||||
Request* in_request = reinterpret_cast<Request*>(in_header);
|
const Request* in_request = reinterpret_cast<const Request*>(in_header);
|
||||||
kern_return_t kr =
|
kern_return_t kr = MIGCheckRequestMachExceptionRaise(in_request);
|
||||||
__MIG_check__Request__mach_exception_raise_t(in_request);
|
|
||||||
if (kr != MACH_MSG_SUCCESS) {
|
if (kr != MACH_MSG_SUCCESS) {
|
||||||
SetReplyError(out_header, kr);
|
SetReplyError(out_header, kr);
|
||||||
return true;
|
return true;
|
||||||
@ -325,12 +377,12 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
case kMachMessageIDMachExceptionRaiseState: {
|
case kMachMessageIDMachExceptionRaiseState: {
|
||||||
// mach_exception_raise_state(), catch_mach_exception_raise_state().
|
// mach_exception_raise_state(), catch_mach_exception_raise_state().
|
||||||
typedef __Request__mach_exception_raise_state_t Request;
|
typedef __Request__mach_exception_raise_state_t Request;
|
||||||
Request* in_request = reinterpret_cast<Request*>(in_header);
|
const Request* in_request = reinterpret_cast<const Request*>(in_header);
|
||||||
|
|
||||||
// in_request_1 is used for the portion of the request after the codes,
|
// in_request_1 is used for the portion of the request after the codes,
|
||||||
// which in theory can be variable-length. The check function will set it.
|
// which in theory can be variable-length. The check function will set it.
|
||||||
Request* in_request_1;
|
const Request* in_request_1;
|
||||||
kern_return_t kr = __MIG_check__Request__mach_exception_raise_state_t(
|
kern_return_t kr = MIGCheckRequestMachExceptionRaiseState(
|
||||||
in_request, &in_request_1);
|
in_request, &in_request_1);
|
||||||
if (kr != MACH_MSG_SUCCESS) {
|
if (kr != MACH_MSG_SUCCESS) {
|
||||||
SetReplyError(out_header, kr);
|
SetReplyError(out_header, kr);
|
||||||
@ -339,13 +391,14 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
|
|
||||||
typedef __Reply__mach_exception_raise_state_t Reply;
|
typedef __Reply__mach_exception_raise_state_t Reply;
|
||||||
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
||||||
|
out_reply->flavor = in_request_1->flavor;
|
||||||
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
||||||
out_reply->RetCode =
|
out_reply->RetCode =
|
||||||
interface_->CatchMachExceptionRaiseState(in_header->msgh_local_port,
|
interface_->CatchMachExceptionRaiseState(in_header->msgh_local_port,
|
||||||
in_request->exception,
|
in_request->exception,
|
||||||
in_request->code,
|
in_request->code,
|
||||||
in_request->codeCnt,
|
in_request->codeCnt,
|
||||||
&in_request_1->flavor,
|
&out_reply->flavor,
|
||||||
in_request_1->old_state,
|
in_request_1->old_state,
|
||||||
in_request_1->old_stateCnt,
|
in_request_1->old_stateCnt,
|
||||||
out_reply->new_state,
|
out_reply->new_state,
|
||||||
@ -354,7 +407,6 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_reply->flavor = in_request_1->flavor;
|
|
||||||
out_header->msgh_size =
|
out_header->msgh_size =
|
||||||
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
||||||
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
||||||
@ -365,13 +417,12 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
// mach_exception_raise_state_identity(),
|
// mach_exception_raise_state_identity(),
|
||||||
// catch_mach_exception_raise_state_identity().
|
// catch_mach_exception_raise_state_identity().
|
||||||
typedef __Request__mach_exception_raise_state_identity_t Request;
|
typedef __Request__mach_exception_raise_state_identity_t Request;
|
||||||
Request* in_request = reinterpret_cast<Request*>(in_header);
|
const Request* in_request = reinterpret_cast<const Request*>(in_header);
|
||||||
|
|
||||||
// in_request_1 is used for the portion of the request after the codes,
|
// in_request_1 is used for the portion of the request after the codes,
|
||||||
// which in theory can be variable-length. The check function will set it.
|
// which in theory can be variable-length. The check function will set it.
|
||||||
Request* in_request_1;
|
const Request* in_request_1;
|
||||||
kern_return_t kr =
|
kern_return_t kr = MIGCheckRequestMachExceptionRaiseStateIdentity(
|
||||||
__MIG_check__Request__mach_exception_raise_state_identity_t(
|
|
||||||
in_request, &in_request_1);
|
in_request, &in_request_1);
|
||||||
if (kr != MACH_MSG_SUCCESS) {
|
if (kr != MACH_MSG_SUCCESS) {
|
||||||
SetReplyError(out_header, kr);
|
SetReplyError(out_header, kr);
|
||||||
@ -380,6 +431,7 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
|
|
||||||
typedef __Reply__mach_exception_raise_state_identity_t Reply;
|
typedef __Reply__mach_exception_raise_state_identity_t Reply;
|
||||||
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
Reply* out_reply = reinterpret_cast<Reply*>(out_header);
|
||||||
|
out_reply->flavor = in_request_1->flavor;
|
||||||
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
out_reply->new_stateCnt = arraysize(out_reply->new_state);
|
||||||
out_reply->RetCode = interface_->CatchMachExceptionRaiseStateIdentity(
|
out_reply->RetCode = interface_->CatchMachExceptionRaiseStateIdentity(
|
||||||
in_header->msgh_local_port,
|
in_header->msgh_local_port,
|
||||||
@ -388,7 +440,7 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
in_request->exception,
|
in_request->exception,
|
||||||
in_request->code,
|
in_request->code,
|
||||||
in_request->codeCnt,
|
in_request->codeCnt,
|
||||||
&in_request_1->flavor,
|
&out_reply->flavor,
|
||||||
in_request_1->old_state,
|
in_request_1->old_state,
|
||||||
in_request_1->old_stateCnt,
|
in_request_1->old_stateCnt,
|
||||||
out_reply->new_state,
|
out_reply->new_state,
|
||||||
@ -398,7 +450,6 @@ bool MachExcServer::MachMessageServerFunction(mach_msg_header_t* in_header,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_reply->flavor = in_request_1->flavor;
|
|
||||||
out_header->msgh_size =
|
out_header->msgh_size =
|
||||||
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
sizeof(*out_reply) - sizeof(out_reply->new_state) +
|
||||||
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
sizeof(out_reply->new_state[0]) * out_reply->new_stateCnt;
|
||||||
@ -603,7 +654,7 @@ UniversalMachExcServer::UniversalMachExcServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool UniversalMachExcServer::MachMessageServerFunction(
|
bool UniversalMachExcServer::MachMessageServerFunction(
|
||||||
mach_msg_header_t* in_header,
|
const mach_msg_header_t* in_header,
|
||||||
mach_msg_header_t* out_header,
|
mach_msg_header_t* out_header,
|
||||||
bool* destroy_complex_request) {
|
bool* destroy_complex_request) {
|
||||||
switch (in_header->msgh_id) {
|
switch (in_header->msgh_id) {
|
||||||
|
@ -104,7 +104,7 @@ class ExcServer : public MachMessageServer::Interface {
|
|||||||
// MachMessageServer::Interface:
|
// MachMessageServer::Interface:
|
||||||
|
|
||||||
virtual bool MachMessageServerFunction(
|
virtual bool MachMessageServerFunction(
|
||||||
mach_msg_header_t* in_header,
|
const mach_msg_header_t* in_header,
|
||||||
mach_msg_header_t* out_header,
|
mach_msg_header_t* out_header,
|
||||||
bool* destroy_complex_request) override;
|
bool* destroy_complex_request) override;
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ class MachExcServer : public MachMessageServer::Interface {
|
|||||||
// MachMessageServer::Interface:
|
// MachMessageServer::Interface:
|
||||||
|
|
||||||
virtual bool MachMessageServerFunction(
|
virtual bool MachMessageServerFunction(
|
||||||
mach_msg_header_t* in_header,
|
const mach_msg_header_t* in_header,
|
||||||
mach_msg_header_t* out_header,
|
mach_msg_header_t* out_header,
|
||||||
bool* destroy_complex_request) override;
|
bool* destroy_complex_request) override;
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ class UniversalMachExcServer
|
|||||||
// MachMessageServer::Interface:
|
// MachMessageServer::Interface:
|
||||||
|
|
||||||
virtual bool MachMessageServerFunction(
|
virtual bool MachMessageServerFunction(
|
||||||
mach_msg_header_t* in_header,
|
const mach_msg_header_t* in_header,
|
||||||
mach_msg_header_t* out_header,
|
mach_msg_header_t* out_header,
|
||||||
bool* destroy_complex_request) override;
|
bool* destroy_complex_request) override;
|
||||||
|
|
||||||
|
@ -37,7 +37,9 @@ class MachMessageServer {
|
|||||||
//! may call such a function directly. This method is expected to behave
|
//! may call such a function directly. This method is expected to behave
|
||||||
//! exactly as these functions behave.
|
//! exactly as these functions behave.
|
||||||
//!
|
//!
|
||||||
//! \param[in] in The request message, received as a Mach message.
|
//! \param[in] in The request message, received as a Mach message. Note that
|
||||||
|
//! this interface uses a `const` parameter for this purpose, whereas
|
||||||
|
//! MIG-generated “demux” functions do not.
|
||||||
//! \param[out] out The reply message. The caller allocates storage, and the
|
//! \param[out] out The reply message. The caller allocates storage, and the
|
||||||
//! callee is expected to populate the reply message appropriately.
|
//! callee is expected to populate the reply message appropriately.
|
||||||
//! After returning, the caller will send this reply as a Mach message
|
//! After returning, the caller will send this reply as a Mach message
|
||||||
@ -62,7 +64,7 @@ class MachMessageServer {
|
|||||||
//! the reply message should be set as `mig_reply_error_t::RetCode`. The
|
//! the reply message should be set as `mig_reply_error_t::RetCode`. The
|
||||||
//! non-`void` return value is used for increased compatibility with
|
//! non-`void` return value is used for increased compatibility with
|
||||||
//! MIG-generated functions.
|
//! MIG-generated functions.
|
||||||
virtual bool MachMessageServerFunction(mach_msg_header_t* in,
|
virtual bool MachMessageServerFunction(const mach_msg_header_t* in,
|
||||||
mach_msg_header_t* out,
|
mach_msg_header_t* out,
|
||||||
bool* destroy_complex_request) = 0;
|
bool* destroy_complex_request) = 0;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ class TestMachMessageServer : public MachMessageServer::Interface,
|
|||||||
// MachMessageServerInterface:
|
// MachMessageServerInterface:
|
||||||
|
|
||||||
virtual bool MachMessageServerFunction(
|
virtual bool MachMessageServerFunction(
|
||||||
mach_msg_header_t* in,
|
const mach_msg_header_t* in,
|
||||||
mach_msg_header_t* out,
|
mach_msg_header_t* out,
|
||||||
bool* destroy_complex_request) override {
|
bool* destroy_complex_request) override {
|
||||||
*destroy_complex_request = options_.server_destroy_complex;
|
*destroy_complex_request = options_.server_destroy_complex;
|
||||||
@ -200,7 +200,7 @@ class TestMachMessageServer : public MachMessageServer::Interface,
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ReceiveRequestMessage* request =
|
const ReceiveRequestMessage* request =
|
||||||
reinterpret_cast<ReceiveRequestMessage*>(in);
|
reinterpret_cast<const ReceiveRequestMessage*>(in);
|
||||||
const mach_msg_bits_t expect_msgh_bits =
|
const mach_msg_bits_t expect_msgh_bits =
|
||||||
MACH_MSGH_BITS(MACH_MSG_TYPE_MOVE_SEND, MACH_MSG_TYPE_MOVE_SEND) |
|
MACH_MSGH_BITS(MACH_MSG_TYPE_MOVE_SEND, MACH_MSG_TYPE_MOVE_SEND) |
|
||||||
(options_.client_send_complex ? MACH_MSGH_BITS_COMPLEX : 0);
|
(options_.client_send_complex ? MACH_MSGH_BITS_COMPLEX : 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user