From e2e50a2471af7c8708d49323a3f000042a032b59 Mon Sep 17 00:00:00 2001 From: Flavio Cruz <flaviocruz@gmail.com> Date: Sun, 7 Feb 2016 20:08:58 -0500 Subject: Cast kernel server port arguments to the correct type. * server.c: Add cast for ipc_port_t arguments that are handled differently. * type.c: Set itKernelPort when the mach_port_t is treated as a ipc_port_t. * type.h: Add itKernelPort to struct ipc_type. --- server.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'server.c') diff --git a/server.c b/server.c index a08795b..37cb6e0 100644 --- a/server.c +++ b/server.c @@ -749,6 +749,18 @@ WriteServerCallArg(FILE *file, const argument_t *arg) const ipc_type_t *it = arg->argType; boolean_t NeedClose = FALSE; + if (IsKernelServer) { + /* If the type (incl. array) is handled differently, then we need to + cast it to the real argument type. */ + if (it->itKernelPort || + it->itInLine && it->itVarArray && it->itElement->itKernelPort) { + /* Some arguments are transformed into the correct type already. */ + if (!akCheckAll(arg->argKind, akbSendRcv|akbVarNeeded)) + fprintf(file, "(%s%s)", it->itTransType, + arg->argByReferenceServer ? "*" : ""); + } + } + if (arg->argByReferenceServer) fprintf(file, "&"); -- cgit v1.2.3