summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmichel2013-06-06 04:38:20 (EDT)
committer Eugene Tarassov2013-06-07 11:46:59 (EDT)
commitce08dcc4685e6fb47c6094155b56f4a107f73430 (patch)
tree97e16e6c12b702da389ae3d939b845e8819fb92a
parentb79bb6537c0769b4c3d2f7ea015bb261ae17da00 (diff)
downloadorg.eclipse.tcf.agent-ce08dcc4685e6fb47c6094155b56f4a107f73430.zip
org.eclipse.tcf.agent-ce08dcc4685e6fb47c6094155b56f4a107f73430.tar.gz
org.eclipse.tcf.agent-ce08dcc4685e6fb47c6094155b56f4a107f73430.tar.bz2
Bug 409909 - Allow clients to provide user defined version of id2ctx()
-rw-r--r--agent/tcf/framework/pid-hash.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/agent/tcf/framework/pid-hash.h b/agent/tcf/framework/pid-hash.h
index 4843ec8..d918929 100644
--- a/agent/tcf/framework/pid-hash.h
+++ b/agent/tcf/framework/pid-hash.h
@@ -18,8 +18,11 @@
* System specific debug context code can use this module to implement context lookup.
*/
-/* TODO: consider splitting the code into two files: some clients might want to reuse PID hash table for context_find_from_pid(),
- * but use some other means to implement id2ctx() */
+/*
+ * NOTE: Some clients might want to reuse PID hash table for
+ * context_find_from_pid(), but use some other means to implement id2ctx():
+ * This can be done by defining ENABLE_USER_DEFINED_id2ctx.
+ */
#define CONTEXT_PID_HASH_SIZE (32 * MEM_USAGE_FACTOR - 1)
#define CONTEXT_PID_HASH(PID) ((unsigned)(PID) % CONTEXT_PID_HASH_SIZE)
@@ -56,12 +59,14 @@ Context * context_find_from_pid(pid_t pid, int thread) {
return NULL;
}
+#if !defined(ENABLE_USER_DEFINED_id2ctx)
Context * id2ctx(const char * id) {
pid_t parent = 0;
pid_t pid = id2pid(id, &parent);
if (pid == 0) return NULL;
return context_find_from_pid(pid, parent != 0);
}
+#endif /* !ENABLE_USER_DEFINED_id2ctx */
static void pid_hash_context_exited(Context * ctx, void * args) {
list_remove(ctx2pidlink(ctx));