From 2929d5e27cc7797053c5ceae5b6737977bfc4df8 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Thu, 28 Nov 2013 12:21:49 +0100 Subject: [PATCH hurd 27/29] XXX i broke rpctrace If we cannot get this to work with protected payloads, we can always add a switch to libports to disable the optimization. --- utils/rpctrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/utils/rpctrace.c b/utils/rpctrace.c index c954e51..18fae83 100644 --- a/utils/rpctrace.c +++ b/utils/rpctrace.c @@ -1219,7 +1219,25 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp) /* Look up our record for the receiving port. There is no need to check the class, because our port bucket only ever contains one class of ports (traced_class). */ - info = ports_lookup_port (traced_bucket, inp->msgh_local_port, 0); + + if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == MACH_MSG_TYPE_PROTECTED_PAYLOAD) + { + info = (struct traced_info *) inp->msgh_protected_payload; + if (info && info->pi.bucket == traced_bucket) + { + ports_port_ref (info); + /* Undo the protected payload optimization for our tracee. */ + inp->msgh_bits = MACH_MSGH_BITS ( + MACH_MSGH_BITS_REMOTE (inp->msgh_bits), + MACH_MSG_TYPE_PORT_SEND); /* XXX we cannot know the real type :( */ + inp->msgh_local_port = ports_payload_get_name (info); + } + else + info = NULL; + } + else + info = ports_lookup_port (traced_bucket, inp->msgh_local_port, 0); + assert (info); /* A notification message from the kernel appears to have been sent -- 2.1.3