fix usertrace and genevent for printf alignment
[lttv.git] / ltt-usertrace / ltt / ltt-facility-user_generic.h
index 94a636dc8297398b944bd413ab7f155a84b269ba..874a83b25092ce2bb52931a316d44a19cd438f52 100644 (file)
@@ -3,16 +3,20 @@
 
 #include <sys/types.h>
 #include <ltt/ltt-facility-id-user_generic.h>
-#include <ltt/ltt-generic.h>
+#include <ltt/ltt-usertrace.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Named types */
 
 /* Event string structures */
 static inline void lttng_write_string_user_generic_string_data(
-               void *buffer,
+               char *buffer,
                size_t *to_base,
                size_t *to,
-               const void **from,
+               const char **from,
                size_t *len,
                const char * obj)
 {
@@ -53,6 +57,9 @@ static inline void lttng_write_string_user_generic_string_data(
 
 
 /* Event string logging function */
+static inline int trace_user_generic_string(
+               const char * lttng_param_data);
+
 #ifndef LTT_TRACE_FAST
 static inline int trace_user_generic_string(
                const char * lttng_param_data)
@@ -62,7 +69,7 @@ static inline int trace_user_generic_string(
 #else
 {
        int ret = 0;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -71,14 +78,14 @@ static inline int trace_user_generic_string(
        size_t *len = &real_len;
        size_t reserve_size;
        size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
                /* For each field, calculate the field size. */
        /* size = *to_base + *to + *len */
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_data;
+       *from = (const char*)lttng_param_data;
        lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
 
        reserve_size = *to_base + *to + *len;
@@ -88,7 +95,7 @@ static inline int trace_user_generic_string(
 
                *to_base = *to = *len = 0;
 
-               *from = lttng_param_data;
+               *from = (const char*)lttng_param_data;
                lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
 
                /* Flush pending memcpy */
@@ -98,7 +105,7 @@ static inline int trace_user_generic_string(
                        *len = 0;
                }
 
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_string, buffer, reserve_size, LTT_BLOCKING);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_string, buffer, reserve_size, LTT_BLOCKING);
        }
 
        return ret;
@@ -118,7 +125,7 @@ static inline int trace_user_generic_string(
        unsigned int index;
        struct ltt_trace_info *trace = thread_trace_info;
        struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -127,8 +134,8 @@ static inline int trace_user_generic_string(
        size_t *len = &real_len;
        size_t reserve_size;
        size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
        uint64_t tsc;
        size_t before_hdr_pad, after_hdr_pad, header_size;
 
@@ -143,12 +150,12 @@ static inline int trace_user_generic_string(
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_data;
+       *from = (const char*)lttng_param_data;
        lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
 
        reserve_size = *to_base + *to + *len;
        trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44,
                                                event_user_generic_string);
 
        {
@@ -162,11 +169,11 @@ static inline int trace_user_generic_string(
                *to_base = *to = *len = 0;
 
                ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_string,
+                       ltt_facility_user_generic_B1865E44, event_user_generic_string,
                        reserve_size, before_hdr_pad, tsc);
                *to_base += before_hdr_pad + after_hdr_pad + header_size;
 
-               *from = lttng_param_data;
+               *from = (const char*)lttng_param_data;
                lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
 
                /* Flush pending memcpy */
@@ -188,10 +195,10 @@ end:
 
 /* Event string_pointer structures */
 static inline void lttng_write_string_user_generic_string_pointer_string(
-               void *buffer,
+               char *buffer,
                size_t *to_base,
                size_t *to,
-               const void **from,
+               const char **from,
                size_t *len,
                const char * obj)
 {
@@ -232,6 +239,10 @@ static inline void lttng_write_string_user_generic_string_pointer_string(
 
 
 /* Event string_pointer logging function */
+static inline int trace_user_generic_string_pointer(
+               const char * lttng_param_string,
+               const void * lttng_param_pointer);
+
 #ifndef LTT_TRACE_FAST
 static inline int trace_user_generic_string_pointer(
                const char * lttng_param_string,
@@ -242,7 +253,7 @@ static inline int trace_user_generic_string_pointer(
 #else
 {
        int ret = 0;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -252,17 +263,17 @@ static inline int trace_user_generic_string_pointer(
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
                /* For each field, calculate the field size. */
        /* size = *to_base + *to + *len */
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_string;
+       *from = (const char*)lttng_param_string;
        lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
 
-       *from = &lttng_param_pointer;
+       *from = (const char*)&lttng_param_pointer;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -280,7 +291,7 @@ static inline int trace_user_generic_string_pointer(
 
                *to_base = *to = *len = 0;
 
-               *from = lttng_param_string;
+               *from = (const char*)lttng_param_string;
                lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
 
                /* Flush pending memcpy */
@@ -290,7 +301,7 @@ static inline int trace_user_generic_string_pointer(
                        *len = 0;
                }
 
-               *from = &lttng_param_pointer;
+               *from = (const char*)&lttng_param_pointer;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -308,7 +319,7 @@ static inline int trace_user_generic_string_pointer(
                        *len = 0;
                }
 
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_string_pointer, buffer, reserve_size, LTT_BLOCKING);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_string_pointer, buffer, reserve_size, LTT_BLOCKING);
        }
 
        return ret;
@@ -329,7 +340,7 @@ static inline int trace_user_generic_string_pointer(
        unsigned int index;
        struct ltt_trace_info *trace = thread_trace_info;
        struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -339,8 +350,8 @@ static inline int trace_user_generic_string_pointer(
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
        uint64_t tsc;
        size_t before_hdr_pad, after_hdr_pad, header_size;
 
@@ -355,10 +366,10 @@ static inline int trace_user_generic_string_pointer(
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_string;
+       *from = (const char*)lttng_param_string;
        lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
 
-       *from = &lttng_param_pointer;
+       *from = (const char*)&lttng_param_pointer;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -371,7 +382,7 @@ static inline int trace_user_generic_string_pointer(
 
        reserve_size = *to_base + *to + *len;
        trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44,
                                                event_user_generic_string_pointer);
 
        {
@@ -385,11 +396,11 @@ static inline int trace_user_generic_string_pointer(
                *to_base = *to = *len = 0;
 
                ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_string_pointer,
+                       ltt_facility_user_generic_B1865E44, event_user_generic_string_pointer,
                        reserve_size, before_hdr_pad, tsc);
                *to_base += before_hdr_pad + after_hdr_pad + header_size;
 
-               *from = lttng_param_string;
+               *from = (const char*)lttng_param_string;
                lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
 
                /* Flush pending memcpy */
@@ -399,7 +410,7 @@ static inline int trace_user_generic_string_pointer(
                        *len = 0;
                }
 
-               *from = &lttng_param_pointer;
+               *from = (const char*)&lttng_param_pointer;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -429,10 +440,10 @@ end:
 
 /* Event slow_printf structures */
 static inline void lttng_write_string_user_generic_slow_printf_string(
-               void *buffer,
+               char *buffer,
                size_t *to_base,
                size_t *to,
-               const void **from,
+               const char **from,
                size_t *len,
                const char * obj)
 {
@@ -473,9 +484,13 @@ static inline void lttng_write_string_user_generic_slow_printf_string(
 
 
 /* Event slow_printf logging function */
+static inline int trace_user_generic_slow_printf_param_buffer(
+               char *buffer,
+               size_t reserve_size);
+
 #ifndef LTT_TRACE_FAST
 static inline int trace_user_generic_slow_printf_param_buffer(
-               void *buffer,
+               char *buffer,
                size_t reserve_size)
 #ifndef LTT_TRACE
 {
@@ -483,9 +498,8 @@ static inline int trace_user_generic_slow_printf_param_buffer(
 #else
 {
        int ret = 0;
-       reserve_size = ltt_align(reserve_size, sizeof(void *));
        {
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_slow_printf, buffer, reserve_size, LTT_BLOCKING);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_slow_printf, buffer, reserve_size, LTT_BLOCKING);
        }
 
        return ret;
@@ -505,7 +519,7 @@ static inline int trace_user_generic_slow_printf(
        unsigned int index;
        struct ltt_trace_info *trace = thread_trace_info;
        struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -514,8 +528,8 @@ static inline int trace_user_generic_slow_printf(
        size_t *len = &real_len;
        size_t reserve_size;
        size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
        uint64_t tsc;
        size_t before_hdr_pad, after_hdr_pad, header_size;
 
@@ -530,12 +544,12 @@ static inline int trace_user_generic_slow_printf(
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_string;
+       *from = (const char*)lttng_param_string;
        lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string);
 
        reserve_size = *to_base + *to + *len;
        trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44,
                                                event_user_generic_slow_printf);
 
        {
@@ -549,11 +563,11 @@ static inline int trace_user_generic_slow_printf(
                *to_base = *to = *len = 0;
 
                ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_slow_printf,
+                       ltt_facility_user_generic_B1865E44, event_user_generic_slow_printf,
                        reserve_size, before_hdr_pad, tsc);
                *to_base += before_hdr_pad + after_hdr_pad + header_size;
 
-               *from = lttng_param_string;
+               *from = (const char*)lttng_param_string;
                lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string);
 
                /* Flush pending memcpy */
@@ -576,8 +590,12 @@ end:
 /* Event function_entry structures */
 
 /* Event function_entry logging function */
-#ifndef LTT_TRACE_FAST
 static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry(
+               const void * lttng_param_this_fn,
+               const void * lttng_param_call_site);
+
+#ifndef LTT_TRACE_FAST
+static inline int trace_user_generic_function_entry(
                const void * lttng_param_this_fn,
                const void * lttng_param_call_site)
 #ifndef LTT_TRACE
@@ -586,7 +604,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 #else
 {
        int ret = 0;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -596,14 +614,14 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
                /* For each field, calculate the field size. */
        /* size = *to_base + *to + *len */
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = &lttng_param_this_fn;
+       *from = (const char*)&lttng_param_this_fn;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -614,7 +632,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
        *len += sizeof(const void *);
 
-       *from = &lttng_param_call_site;
+       *from = (const char*)&lttng_param_call_site;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -632,7 +650,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
                *to_base = *to = *len = 0;
 
-               *from = &lttng_param_this_fn;
+               *from = (const char*)&lttng_param_this_fn;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -650,7 +668,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -668,7 +686,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                        *len = 0;
                }
 
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_function_entry, buffer, reserve_size, LTT_BLOCKING);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_function_entry, buffer, reserve_size, LTT_BLOCKING);
        }
 
        return ret;
@@ -689,7 +707,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        unsigned int index;
        struct ltt_trace_info *trace = thread_trace_info;
        struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -699,8 +717,8 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
        uint64_t tsc;
        size_t before_hdr_pad, after_hdr_pad, header_size;
 
@@ -715,7 +733,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = &lttng_param_this_fn;
+       *from = (const char*)&lttng_param_this_fn;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -726,7 +744,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
        *len += sizeof(const void *);
 
-       *from = &lttng_param_call_site;
+       *from = (const char*)&lttng_param_call_site;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -739,7 +757,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
        reserve_size = *to_base + *to + *len;
        trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44,
                                                event_user_generic_function_entry);
 
        {
@@ -753,11 +771,11 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *to_base = *to = *len = 0;
 
                ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_function_entry,
+                       ltt_facility_user_generic_B1865E44, event_user_generic_function_entry,
                        reserve_size, before_hdr_pad, tsc);
                *to_base += before_hdr_pad + after_hdr_pad + header_size;
 
-               *from = &lttng_param_this_fn;
+               *from = (const char*)&lttng_param_this_fn;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -775,7 +793,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -806,8 +824,12 @@ end:
 /* Event function_exit structures */
 
 /* Event function_exit logging function */
-#ifndef LTT_TRACE_FAST
 static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit(
+               const void * lttng_param_this_fn,
+               const void * lttng_param_call_site);
+
+#ifndef LTT_TRACE_FAST
+static inline int trace_user_generic_function_exit(
                const void * lttng_param_this_fn,
                const void * lttng_param_call_site)
 #ifndef LTT_TRACE
@@ -816,7 +838,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 #else
 {
        int ret = 0;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -826,14 +848,14 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
                /* For each field, calculate the field size. */
        /* size = *to_base + *to + *len */
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = &lttng_param_this_fn;
+       *from = (const char*)&lttng_param_this_fn;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -844,7 +866,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
        *len += sizeof(const void *);
 
-       *from = &lttng_param_call_site;
+       *from = (const char*)&lttng_param_call_site;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -862,7 +884,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
                *to_base = *to = *len = 0;
 
-               *from = &lttng_param_this_fn;
+               *from = (const char*)&lttng_param_this_fn;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -880,7 +902,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -898,7 +920,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                        *len = 0;
                }
 
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_function_exit, buffer, reserve_size, LTT_BLOCKING);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_function_exit, buffer, reserve_size, LTT_BLOCKING);
        }
 
        return ret;
@@ -919,7 +941,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        unsigned int index;
        struct ltt_trace_info *trace = thread_trace_info;
        struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -929,8 +951,8 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
        uint64_t tsc;
        size_t before_hdr_pad, after_hdr_pad, header_size;
 
@@ -945,7 +967,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = &lttng_param_this_fn;
+       *from = (const char*)&lttng_param_this_fn;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -956,7 +978,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
        *len += sizeof(const void *);
 
-       *from = &lttng_param_call_site;
+       *from = (const char*)&lttng_param_call_site;
        align = sizeof(const void *);
 
        if(*len == 0) {
@@ -969,7 +991,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
 
        reserve_size = *to_base + *to + *len;
        trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44,
                                                event_user_generic_function_exit);
 
        {
@@ -983,11 +1005,11 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *to_base = *to = *len = 0;
 
                ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_function_exit,
+                       ltt_facility_user_generic_B1865E44, event_user_generic_function_exit,
                        reserve_size, before_hdr_pad, tsc);
                *to_base += before_hdr_pad + after_hdr_pad + header_size;
 
-               *from = &lttng_param_this_fn;
+               *from = (const char*)&lttng_param_this_fn;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -1005,7 +1027,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
                if(*len == 0) {
@@ -1033,4 +1055,190 @@ end:
 #endif //LTT_TRACE
 #endif //LTT_TRACE_FAST
 
+/* Event thread_brand structures */
+static inline void lttng_write_string_user_generic_thread_brand_name(
+               char *buffer,
+               size_t *to_base,
+               size_t *to,
+               const char **from,
+               size_t *len,
+               const char * obj)
+{
+       size_t size;
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(char);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       size = strlen(obj) + 1; /* Include final NULL char. */
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj, size);
+       *to += size;
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C string */
+       *from += size;
+}
+
+
+/* Event thread_brand logging function */
+static inline int trace_user_generic_thread_brand(
+               const char * lttng_param_name);
+
+#ifndef LTT_TRACE_FAST
+static inline int trace_user_generic_thread_brand(
+               const char * lttng_param_name)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       int ret = 0;
+       char *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       const char *real_from;
+       const char **from = &real_from;
+               /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = (const char*)lttng_param_name;
+       lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name);
+
+       reserve_size = *to_base + *to + *len;
+       {
+               char stack_buffer[reserve_size];
+               buffer = stack_buffer;
+
+               *to_base = *to = *len = 0;
+
+               *from = (const char*)lttng_param_name;
+               lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_thread_brand, buffer, reserve_size, LTT_BLOCKING);
+       }
+
+       return ret;
+
+}
+#endif //LTT_TRACE
+#endif //!LTT_TRACE_FAST
+
+#ifdef LTT_TRACE_FAST
+static inline int trace_user_generic_thread_brand(
+               const char * lttng_param_name)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_trace_info *trace = thread_trace_info;
+       struct ltt_buf *ltt_buf;
+       char *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       const char *real_from;
+       const char **from = &real_from;
+       uint64_t tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(!trace) {
+               ltt_thread_init();
+               trace = thread_trace_info;
+       }
+
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = (const char*)lttng_param_name;
+       lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name);
+
+       reserve_size = *to_base + *to + *len;
+       trace->nesting++;
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44,
+                                               event_user_generic_thread_brand);
+
+       {
+               ltt_buf = ltt_get_channel_from_index(trace, index);
+                               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, ltt_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) goto end; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, ltt_buf, buffer,
+                       ltt_facility_user_generic_B1865E44, event_user_generic_thread_brand,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = (const char*)lttng_param_name;
+               lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(ltt_buf, buffer, slot_size);
+
+}
+
+end:
+       trace->nesting--;
+}
+#endif //LTT_TRACE
+#endif //LTT_TRACE_FAST
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
 #endif //_LTT_FACILITY_USER_GENERIC_H_
This page took 0.051326 seconds and 4 git commands to generate.