[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 86/98: utils/rpctrace: fix output so that replies can be attribut
From: |
Samuel Thibault |
Subject: |
[hurd] 86/98: utils/rpctrace: fix output so that replies can be attributed to requests |
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 b372e439e05e336d5e52aa0ce69c799c15691932
Author: Justus Winter <address@hidden>
Date: Fri Dec 13 15:25:22 2013 +0100
utils/rpctrace: fix output so that replies can be attributed to requests
Currently, it is impossible to properly attribute response messages to
requests. Even though rpctrace is single-threaded, its tracee may
not. Or there might be more than one tracee. In any such case it is
not guaranteed that the reply message we just processed is for the
request we just printed. Fix this by printing ellipsis with the port
name, so that reply messages can be properly attributed:
task129(pid3312)->mach_port_allocate (3) ...134
task129(pid3312)->mach_port_deallocate (pn{ 1}) ...160
134... = 0 pn{ 30}
160... = 0
* utils/rpctrace.c (last_reply_port): New variable.
(print_ellipsis): New function.
(print_request_header): Optionally print ellipsis and update
last_reply_port.
(print_reply_header): Likewise.
---
utils/rpctrace.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 0f68f44..d7ee203 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1,7 +1,7 @@
/* Trace RPCs sent to selected ports
- Copyright (C) 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2009, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2009, 2011,
+ 2013 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -1486,10 +1486,27 @@ static const char *const msg_types[] =
};
#endif
+/* We keep track of the last reply port used in a request we print to
+ ostream. This way we can end incomplete requests with an ellipsis
+ and the name of the reply port. When the reply finally arrives, we
+ start a new line with that port name and an ellipsis, making it
+ easy to match it to the associated request. */
+static mach_port_t last_reply_port;
+
+/* Print an ellipsis if necessary. */
+static void
+print_ellipsis (void)
+{
+ if (MACH_PORT_VALID (last_reply_port))
+ fprintf (ostream, " ...%u\n", (unsigned int) last_reply_port);
+}
+
static void
print_request_header (struct sender_info *receiver, mach_msg_header_t *msg)
{
const char *msgname = msgid_name (msg->msgh_id);
+ print_ellipsis ();
+ last_reply_port = msg->msgh_local_port;
if (TRACED_INFO (receiver)->name != 0)
fprintf (ostream, "%4s->", TRACED_INFO (receiver)->name);
@@ -1507,6 +1524,13 @@ static void
print_reply_header (struct send_once_info *info, mig_reply_header_t *reply,
struct req_info *req)
{
+ if (last_reply_port != info->pi.pi.port_right)
+ {
+ print_ellipsis ();
+ fprintf (ostream, "%u...", (unsigned int) info->pi.pi.port_right);
+ }
+ last_reply_port = MACH_PORT_NULL;
+
/* We have printed a partial line for the request message,
and now we have the corresponding reply. */
if (reply->Head.msgh_id == req->req_id + 100)
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 10/98: auth: fix use of uninitialized variable err, (continued)
- [hurd] 10/98: auth: fix use of uninitialized variable err, Samuel Thibault, 2014/01/13
- [hurd] 61/98: trans: fix transparent reauthentication in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 01/98: pfinet: fix emission on the loopback device, Samuel Thibault, 2014/01/13
- [hurd] 63/98: libfshelp: use a hash table in get-identity.c, Samuel Thibault, 2014/01/13
- [hurd] 90/98: trans/mtab: populate mtab objects on demand, Samuel Thibault, 2014/01/13
- [hurd] 09/98: init: fix memory leak, Samuel Thibault, 2014/01/13
- [hurd] 88/98: libports: remove the threadvars stack size hack, Samuel Thibault, 2014/01/13
- [hurd] 02/98: Normalize whitespace at the end of each file to '\n', Samuel Thibault, 2014/01/13
- [hurd] 84/98: utils/rpctrace: handle MACH_MSG_TYPE_PORT_SEND rights in trace_and_forward, Samuel Thibault, 2014/01/13
- [hurd] 82/98: utils/rpctrace: generalize code in rewrite_right, Samuel Thibault, 2014/01/13
- [hurd] 86/98: utils/rpctrace: fix output so that replies can be attributed to requests,
Samuel Thibault <=
- [hurd] 81/98: utils/mount: fix autodetection of fat file systems, Samuel Thibault, 2014/01/13
- [hurd] 79/98: trans/fakeroot: remove dead code, Samuel Thibault, 2014/01/13
- [hurd] 85/98: utils/rpctrace: escape non-printable characters in strings, Samuel Thibault, 2014/01/13
- [hurd] 80/98: trans/fakeroot: remove dead code, Samuel Thibault, 2014/01/13
- [hurd] 83/98: utils/rpctrace: generalize tracing code, Samuel Thibault, 2014/01/13
- [hurd] 89/98: libps: fix process user and system times, Samuel Thibault, 2014/01/13
- [hurd] 87/98: trans/fakeroot: shutdown the translator if the last client is gone, Samuel Thibault, 2014/01/13