update usertrade to support g++
[lttv.git] / ltt-usertrace / ltt / ltt-usertrace.h
index 373315ab0d052c577eac08f4e347e924a25b8811..4416da45fe9290f7b204f5d82d44c3d59ab23feb 100644 (file)
 #include <string.h>
 #include <stdint.h>
 #include <sys/types.h>
-#include <linux/unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 #define inline inline __attribute__((always_inline))
 
 #include <ltt/system-ppc.h>
 #include <ltt/timex-ppc.h>
 #endif
+#elif defined(__x86_64__)
+#include <ltt/kernelutils-x86_64.h>
+#elif defined(__i386__)
+#include <ltt/kernelutils-i386.h>
 #else
-#include <asm/timex.h>
-#include <asm/atomic.h>
+#error "Unsupported architecture"
 #endif
 
 #ifndef min
 #define NR_syscalls 319
 #endif
 
+#ifdef __x86_64__
+#define __NR_ltt_trace_generic 279
+#define __NR_ltt_register_generic      280
+#undef NR_syscalls
+#define NR_syscalls 281
+#endif
+
 #ifdef __powerpc__
 #define __NR_ltt_trace_generic 301
 #define __NR_ltt_register_generic      302
@@ -89,19 +103,25 @@ struct user_facility_info {
   size_t pointer_size;
   size_t size_t_size;
 };
-
+#if 0
 static inline __attribute__((no_instrument_function)) 
 _syscall5(int, ltt_trace_generic, unsigned int, facility_id,
        unsigned int, event_id, void *, data, size_t, data_size, int, blocking)
 static inline __attribute__((no_instrument_function))
 _syscall2(int, ltt_register_generic, unsigned int *, facility_id,
        const struct user_facility_info *, info)
+#endif //0
+
+#define ltt_register_generic(...)  syscall(__NR_ltt_register_generic, __VA_ARGS__)
+#define ltt_trace_generic(...)  syscall(__NR_ltt_trace_generic, __VA_ARGS__)
+
+static inline unsigned int __attribute__((no_instrument_function)) 
+       ltt_align(size_t align_drift, size_t size_of_type);
 
 #ifndef LTT_PACK
 /* Calculate the offset needed to align the type */
-static inline unsigned int __attribute__((no_instrument_function))
-                                                                                                               ltt_align(size_t align_drift,
-                                      size_t size_of_type)
+static inline unsigned int
+       ltt_align(size_t align_drift, size_t size_of_type)
 {
   size_t alignment = min(sizeof(void*), size_of_type);
 
@@ -109,19 +129,19 @@ static inline unsigned int __attribute__((no_instrument_function))
 }
 #define LTT_ALIGN
 #else
-static inline unsigned int __attribute__((no_instrument_function))
-                                                                                                               ltt_align(size_t align_drift,
-                                      size_t size_of_type)
+static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type)
 {
   return 0;
 }
 #define LTT_ALIGN __attribute__((packed))
 #endif //LTT_PACK
 
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
 #ifdef LTT_TRACE_FAST
 #include <ltt/ltt-usertrace-fast.h>
 #endif //LTT_TRACE_FAST
 
 #endif //_LTT_USERTRACE_H
-
-
This page took 0.023088 seconds and 4 git commands to generate.