commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 83/98: utils/rpctrace: generalize tracing code


From: Samuel Thibault
Subject: [hurd] 83/98: utils/rpctrace: generalize tracing code
Date: Tue, 14 Jan 2014 02:00:04 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 9a1bb117c165bbedb2b75578ac71e46f2139470e
Author: Justus Winter <address@hidden>
Date:   Wed Dec 11 11:35:39 2013 +0100

    utils/rpctrace: generalize tracing code
    
    Currently, rpctrace dies if a tracee uses select(2) because it asserts
    that reply_type is a MACH_MSG_TYPE_PORT_SEND_ONCE right.  Generalize
    the code surrounding the failing assertion.
    
    * utils/rpctrace.c (trace_and_forward): Generalize code by switching
    over reply_type.
---
 utils/rpctrace.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 9433ef3..5d3b2ca 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1284,24 +1284,30 @@ trace_and_forward (mach_msg_header_t *inp, 
mach_msg_header_t *outp)
        /* The reply port might be dead, e.g., the traced task has died. */
        && MACH_PORT_VALID (inp->msgh_local_port))
       {
-       struct send_once_info *info;
-       // TODO is the reply port always a send once right?
-       assert (reply_type == MACH_MSG_TYPE_PORT_SEND_ONCE);
-       info = new_send_once_wrapper (inp->msgh_local_port,
-                                     &inp->msgh_local_port);
-       reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
-       assert (inp->msgh_local_port);
-
-       if (TRACED_INFO (info)->name == 0)
+       switch (reply_type)
          {
-           if (msgid == 0)
-             asprintf (&TRACED_INFO (info)->name, "reply(%u:%u)",
-                       (unsigned int) TRACED_INFO (info)->pi.port_right,
-                       (unsigned int) inp->msgh_id);
-           else
-             asprintf (&TRACED_INFO (info)->name, "reply(%u:%s)",
-                       (unsigned int) TRACED_INFO (info)->pi.port_right,
-                       msgid->name);
+         case MACH_MSG_TYPE_PORT_SEND_ONCE:;
+           struct send_once_info *info;
+           info = new_send_once_wrapper (inp->msgh_local_port,
+                                         &inp->msgh_local_port);
+           reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
+           assert (inp->msgh_local_port);
+
+           if (TRACED_INFO (info)->name == 0)
+             {
+               if (msgid == 0)
+                 asprintf (&TRACED_INFO (info)->name, "reply(%u:%u)",
+                           (unsigned int) TRACED_INFO (info)->pi.port_right,
+                           (unsigned int) inp->msgh_id);
+               else
+                 asprintf (&TRACED_INFO (info)->name, "reply(%u:%s)",
+                           (unsigned int) TRACED_INFO (info)->pi.port_right,
+                           msgid->name);
+             }
+           break;
+
+         default:
+           error (1, 0, "Reply type %i not handled", reply_type);
          }
       }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]