Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2015-06-15 13:54:43 +0000
committerAnton Leherbauer2015-06-15 13:54:43 +0000
commit312ef127d606c5ca6892a4a133ef342bf44c42ea (patch)
tree7d5f067b764e213d7cb3af864697e3c0794ce630
parent930ca5791464e58f47049e44d0cae431901d9b52 (diff)
downloadorg.eclipse.tcf.agent-312ef127d606c5ca6892a4a133ef342bf44c42ea.tar.gz
org.eclipse.tcf.agent-312ef127d606c5ca6892a4a133ef342bf44c42ea.tar.xz
org.eclipse.tcf.agent-312ef127d606c5ca6892a4a133ef342bf44c42ea.zip
Bug 470179 - Add SysMonitor context properties "Exe" and "ExeType"
Change-Id: I5c50ff41faef3fdb2f01d66ebcb54d7c8463394e Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
-rw-r--r--agent/tcf/services/sysmon.c26
-rw-r--r--agent/tcf/services/sysmon.h7
2 files changed, 31 insertions, 2 deletions
diff --git a/agent/tcf/services/sysmon.c b/agent/tcf/services/sysmon.c
index 57edaede..2935e4d2 100644
--- a/agent/tcf/services/sysmon.c
+++ b/agent/tcf/services/sysmon.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -1080,6 +1080,30 @@ static void write_context(OutputStream * out, char * id, char * parent_id, char
write_stream(out, ',');
}
+ if ((sz = readlink("exe", fnm, FILE_PATH_SIZE)) > 0) {
+ fnm[sz] = 0;
+ json_write_string(out, "Exe");
+ write_stream(out, ':');
+ json_write_string(out, fnm);
+ write_stream(out, ',');
+ json_write_string(out, "ExeType");
+ write_stream(out, ':');
+ json_write_long(out, EXETYPE_USER);
+ write_stream(out, ',');
+ }
+ else if (errno == ENOENT) {
+ json_write_string(out, "ExeType");
+ write_stream(out, ':');
+ json_write_long(out, EXETYPE_KERNEL);
+ write_stream(out, ',');
+ }
+ else if (errno == EACCES) {
+ json_write_string(out, "ExeType");
+ write_stream(out, ':');
+ json_write_long(out, EXETYPE_ACCESS_DENIED);
+ write_stream(out, ',');
+ }
+
f = open("stat", O_RDONLY);
if (f >= 0) {
struct stat st;
diff --git a/agent/tcf/services/sysmon.h b/agent/tcf/services/sysmon.h
index cc53b08b..44cbf29f 100644
--- a/agent/tcf/services/sysmon.h
+++ b/agent/tcf/services/sysmon.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -22,6 +22,11 @@
#include <tcf/framework/protocol.h>
+/* Constants for context property "ExeType" */
+#define EXETYPE_USER 0 /* user process */
+#define EXETYPE_KERNEL 1 /* kernel thread */
+#define EXETYPE_ACCESS_DENIED 2 /* access denied */
+
/*
* Initialize system monitor service.
*/

Back to the top