[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
- [hurd] 09/98: init: fix memory leak, (continued)
- [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, 2014/01/13
- [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 <=
- [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