Signed-off-by: Yannick Brosseau <[email protected]>
---
 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


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to