[lttng-dev] [LTTng-module PATCH] Update prink:console tracepoint for 3.10 kernel

Yannick Brosseau yannick.brosseau at gmail.com
Fri Jun 28 01:14:29 EDT 2013


Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
 instrumentation/events/lttng-module/printk.h |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/instrumentation/events/lttng-module/printk.h b/instrumentation/events/lttng-module/printk.h
index 4c744f9..16f5716 100644
--- a/instrumentation/events/lttng-module/printk.h
+++ b/instrumentation/events/lttng-module/printk.h
@@ -9,6 +9,31 @@
 
 #define MSG_TRACE_MAX_LEN	2048
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
+TRACE_EVENT(console,
+        TP_PROTO(const char *text, size_t len),
+
+        TP_ARGS(text, len),
+
+        TP_STRUCT__entry(
+                __dynamic_array_text(char, msg, min_t(unsigned, len, MSG_TRACE_MAX_LEN))
+        ),
+
+        TP_fast_assign(
+                tp_memcpy_dyn(msg,
+                        ({
+                                char lmsg[MSG_TRACE_MAX_LEN + 1];
+				unsigned start = 0;
+                                if (len > MSG_TRACE_MAX_LEN) {
+                                        start = len - MSG_TRACE_MAX_LEN;
+					len = MSG_TRACE_MAX_LEN;
+				}
+                                memcpy(lmsg, text + start, len);
+                                lmsg[len] = 0;
+                                lmsg;
+                        })
+                )
+#else
 TRACE_EVENT_CONDITION(console,
 	TP_PROTO(const char *log_buf, unsigned start, unsigned end,
 		 unsigned log_buf_len),
@@ -54,6 +79,7 @@ TRACE_EVENT_CONDITION(console,
 				lmsg;
 			})
 		)
+#endif
 	),
 
 	TP_printk("%s", __get_str(msg))
-- 
1.7.10.4




More information about the lttng-dev mailing list