summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Tepavich2012-03-20 12:14:32 (EDT)
committerEugene Tarassov2012-03-20 13:27:36 (EDT)
commit3364ae47f9cf79a0c5dfa900078805bc2f978c83 (patch)
tree0aae474366a97e9da036b3134a248703a960abbf
parent2b11b7d5e7e3a277223f01de3137e5bcca087cde (diff)
downloadorg.eclipse.tcf.agent-3364ae47f9cf79a0c5dfa900078805bc2f978c83.zip
org.eclipse.tcf.agent-3364ae47f9cf79a0c5dfa900078805bc2f978c83.tar.gz
org.eclipse.tcf.agent-3364ae47f9cf79a0c5dfa900078805bc2f978c83.tar.bz2
Bug [374788] Add kernel name as comparitor for context queries
-rw-r--r--agent/system/GNU/Linux/tcf/context-linux.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/agent/system/GNU/Linux/tcf/context-linux.c b/agent/system/GNU/Linux/tcf/context-linux.c
index 361de6d..e9da67d 100644
--- a/agent/system/GNU/Linux/tcf/context-linux.c
+++ b/agent/system/GNU/Linux/tcf/context-linux.c
@@ -32,6 +32,7 @@
#include <ctype.h>
#include <asm/unistd.h>
#include <sys/ptrace.h>
+#include <sys/utsname.h>
#include <linux/kdev_t.h>
#include <tcf/framework/context.h>
#include <tcf/framework/events.h>
@@ -1383,6 +1384,14 @@ static int cmp_linux_tid(Context * ctx, const char * v) {
return ctx->parent != NULL && EXT(ctx)->pid == atoi(v);
}
+static int cmp_linux_kernel_name(Context * ctx, const char * v) {
+ struct utsname un;
+ if (uname(&un) != 0) {
+ return 0;
+ }
+ return (strcmp(un.sysname, v)== 0);
+}
+
void init_contexts_sys_dep(void) {
context_extension_offset = context_extension(sizeof(ContextExtensionLinux));
add_waitpid_listener(waitpid_listener, NULL);
@@ -1394,6 +1403,7 @@ void init_contexts_sys_dep(void) {
create_eventpoint("main", NULL, eventpoint_at_main, NULL);
add_context_query_comparator("pid", cmp_linux_pid);
add_context_query_comparator("tid", cmp_linux_tid);
+ add_context_query_comparator("KernelName", cmp_linux_kernel_name);
}
#endif /* if ENABLE_DebugContext */