ltt-control 0.37
[lttv.git] / ltt-usertrace / ltt / ltt-facility-user_generic.h
index d94ace9adebc920f95cf40bcb18c60260655854e..1bf5fac138bf4217229941a9fa5b627fc41e2890 100644 (file)
@@ -5,14 +5,18 @@
 #include <ltt/ltt-facility-id-user_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)
 {
@@ -20,8 +24,8 @@ static inline void lttng_write_string_user_generic_string_data(
        size_t align;
 
        /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
+       if (*len != 0) {
+               if (buffer != NULL)
                        memcpy(buffer+*to_base+*to, *from, *len);
        }
        *to += *len;
@@ -29,7 +33,7 @@ static inline void lttng_write_string_user_generic_string_data(
 
        align = sizeof(char);
 
-       if(*len == 0) {
+       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 */
@@ -38,7 +42,7 @@ static inline void lttng_write_string_user_generic_string_data(
        /* Contains variable sized fields : must explode the structure */
 
        size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
+       if (buffer != NULL)
                memcpy(buffer+*to_base+*to, obj, size);
        *to += size;
 
@@ -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,17 +95,17 @@ 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 */
-               if(*len != 0) {
+               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_string, buffer, reserve_size, LTT_BLOCKING);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_string, buffer, reserve_size, LTT_BLOCKING, 0);
        }
 
        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,12 +134,10 @@ 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;
-
-       if(!trace) {
+               if (!trace) {
                ltt_thread_init();
                trace = thread_trace_info;
        }
@@ -143,7 +148,7 @@ 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;
@@ -155,22 +160,20 @@ static inline int trace_user_generic_string(
                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 */
+                       reserve_size, &slot_size, &tsc);
+               if (!buffer)
+                       goto end; /* buffer full */
 
                *to_base = *to = *len = 0;
 
-               ltt_write_event_header(trace, ltt_buf, buffer,
+               buffer = ltt_write_event_header(trace, ltt_buf, buffer,
                        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;
+                       reserve_size, tsc);
+               *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 */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
@@ -188,10 +191,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)
 {
@@ -199,8 +202,8 @@ static inline void lttng_write_string_user_generic_string_pointer_string(
        size_t align;
 
        /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
+       if (*len != 0) {
+               if (buffer != NULL)
                        memcpy(buffer+*to_base+*to, *from, *len);
        }
        *to += *len;
@@ -208,7 +211,7 @@ static inline void lttng_write_string_user_generic_string_pointer_string(
 
        align = sizeof(char);
 
-       if(*len == 0) {
+       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 */
@@ -217,7 +220,7 @@ static inline void lttng_write_string_user_generic_string_pointer_string(
        /* Contains variable sized fields : must explode the structure */
 
        size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
+       if (buffer != NULL)
                memcpy(buffer+*to_base+*to, obj, size);
        *to += size;
 
@@ -232,6 +235,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 +249,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,20 +259,20 @@ 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) {
+       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 */
@@ -280,20 +287,20 @@ 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 */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = &lttng_param_pointer;
+               *from = (const char*)&lttng_param_pointer;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -302,13 +309,13 @@ static inline int trace_user_generic_string_pointer(
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               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_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, 0);
        }
 
        return ret;
@@ -329,7 +336,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,12 +346,10 @@ 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;
-
-       if(!trace) {
+               if (!trace) {
                ltt_thread_init();
                trace = thread_trace_info;
        }
@@ -355,13 +360,13 @@ 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) {
+       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 */
@@ -378,31 +383,29 @@ static inline int trace_user_generic_string_pointer(
                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 */
+                       reserve_size, &slot_size, &tsc);
+               if (!buffer)
+                       goto end; /* buffer full */
 
                *to_base = *to = *len = 0;
 
-               ltt_write_event_header(trace, ltt_buf, buffer,
+               buffer = ltt_write_event_header(trace, ltt_buf, buffer,
                        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;
+                       reserve_size, tsc);
+               *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 */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = &lttng_param_pointer;
+               *from = (const char*)&lttng_param_pointer;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -411,7 +414,7 @@ static inline int trace_user_generic_string_pointer(
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
@@ -429,10 +432,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)
 {
@@ -440,8 +443,8 @@ static inline void lttng_write_string_user_generic_slow_printf_string(
        size_t align;
 
        /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
+       if (*len != 0) {
+               if (buffer != NULL)
                        memcpy(buffer+*to_base+*to, *from, *len);
        }
        *to += *len;
@@ -449,7 +452,7 @@ static inline void lttng_write_string_user_generic_slow_printf_string(
 
        align = sizeof(char);
 
-       if(*len == 0) {
+       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 */
@@ -458,7 +461,7 @@ static inline void lttng_write_string_user_generic_slow_printf_string(
        /* Contains variable sized fields : must explode the structure */
 
        size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
+       if (buffer != NULL)
                memcpy(buffer+*to_base+*to, obj, size);
        *to += size;
 
@@ -473,9 +476,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 +490,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_B1865E44, 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, 0);
        }
 
        return ret;
@@ -505,7 +511,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,12 +520,10 @@ 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;
-
-       if(!trace) {
+               if (!trace) {
                ltt_thread_init();
                trace = thread_trace_info;
        }
@@ -530,7 +534,7 @@ 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;
@@ -542,22 +546,20 @@ static inline int trace_user_generic_slow_printf(
                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 */
+                       reserve_size, &slot_size, &tsc);
+               if (!buffer)
+                       goto end; /* buffer full */
 
                *to_base = *to = *len = 0;
 
-               ltt_write_event_header(trace, ltt_buf, buffer,
+               buffer = ltt_write_event_header(trace, ltt_buf, buffer,
                        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;
+                       reserve_size, tsc);
+               *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 */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
@@ -576,8 +578,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 +592,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,17 +602,17 @@ 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) {
+       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 */
@@ -614,10 +620,10 @@ 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) {
+       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 */
@@ -632,10 +638,10 @@ 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) {
+               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 */
@@ -644,16 +650,16 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -662,13 +668,13 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               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_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, 0);
        }
 
        return ret;
@@ -689,7 +695,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,12 +705,10 @@ 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;
-
-       if(!trace) {
+               if (!trace) {
                ltt_thread_init();
                trace = thread_trace_info;
        }
@@ -715,10 +719,10 @@ 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) {
+       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 */
@@ -726,10 +730,10 @@ 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) {
+       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 */
@@ -746,21 +750,19 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                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 */
+                       reserve_size, &slot_size, &tsc);
+               if (!buffer)
+                       goto end; /* buffer full */
 
                *to_base = *to = *len = 0;
 
-               ltt_write_event_header(trace, ltt_buf, buffer,
+               buffer = ltt_write_event_header(trace, ltt_buf, buffer,
                        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;
+                       reserve_size, tsc);
+               *from = (const char*)&lttng_param_this_fn;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -769,16 +771,16 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -787,7 +789,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
@@ -806,8 +808,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 +822,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,17 +832,17 @@ 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) {
+       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 */
@@ -844,10 +850,10 @@ 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) {
+       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 */
@@ -862,10 +868,10 @@ 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) {
+               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 */
@@ -874,16 +880,16 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -892,13 +898,13 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               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_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, 0);
        }
 
        return ret;
@@ -919,7 +925,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,12 +935,10 @@ 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;
-
-       if(!trace) {
+               if (!trace) {
                ltt_thread_init();
                trace = thread_trace_info;
        }
@@ -945,10 +949,10 @@ 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) {
+       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 */
@@ -956,10 +960,10 @@ 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) {
+       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 */
@@ -976,21 +980,19 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                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 */
+                       reserve_size, &slot_size, &tsc);
+               if (!buffer)
+                       goto end; /* buffer full */
 
                *to_base = *to = *len = 0;
 
-               ltt_write_event_header(trace, ltt_buf, buffer,
+               buffer = ltt_write_event_header(trace, ltt_buf, buffer,
                        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;
+                       reserve_size, tsc);
+               *from = (const char*)&lttng_param_this_fn;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -999,16 +1001,16 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = &lttng_param_call_site;
+               *from = (const char*)&lttng_param_call_site;
                align = sizeof(const void *);
 
-               if(*len == 0) {
+               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 */
@@ -1017,7 +1019,7 @@ static inline __attribute__((no_instrument_function)) int trace_user_generic_fun
                *len += sizeof(const void *);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
@@ -1035,10 +1037,10 @@ end:
 
 /* Event thread_brand structures */
 static inline void lttng_write_string_user_generic_thread_brand_name(
-               void *buffer,
+               char *buffer,
                size_t *to_base,
                size_t *to,
-               const void **from,
+               const char **from,
                size_t *len,
                const char * obj)
 {
@@ -1046,8 +1048,8 @@ static inline void lttng_write_string_user_generic_thread_brand_name(
        size_t align;
 
        /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
+       if (*len != 0) {
+               if (buffer != NULL)
                        memcpy(buffer+*to_base+*to, *from, *len);
        }
        *to += *len;
@@ -1055,7 +1057,7 @@ static inline void lttng_write_string_user_generic_thread_brand_name(
 
        align = sizeof(char);
 
-       if(*len == 0) {
+       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 */
@@ -1064,7 +1066,7 @@ static inline void lttng_write_string_user_generic_thread_brand_name(
        /* Contains variable sized fields : must explode the structure */
 
        size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
+       if (buffer != NULL)
                memcpy(buffer+*to_base+*to, obj, size);
        *to += size;
 
@@ -1079,6 +1081,9 @@ static inline void lttng_write_string_user_generic_thread_brand_name(
 
 
 /* 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)
@@ -1088,7 +1093,7 @@ static inline int trace_user_generic_thread_brand(
 #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;
@@ -1097,14 +1102,14 @@ static inline int trace_user_generic_thread_brand(
        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_name;
+       *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;
@@ -1114,17 +1119,17 @@ static inline int trace_user_generic_thread_brand(
 
                *to_base = *to = *len = 0;
 
-               *from = lttng_param_name;
+               *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) {
+               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);
+               ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_thread_brand, buffer, reserve_size, LTT_BLOCKING, 1);
        }
 
        return ret;
@@ -1144,7 +1149,7 @@ static inline int trace_user_generic_thread_brand(
        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;
@@ -1153,12 +1158,10 @@ static inline int trace_user_generic_thread_brand(
        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;
-
-       if(!trace) {
+               if (!trace) {
                ltt_thread_init();
                trace = thread_trace_info;
        }
@@ -1169,7 +1172,7 @@ static inline int trace_user_generic_thread_brand(
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_name;
+       *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;
@@ -1181,22 +1184,20 @@ static inline int trace_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 */
+                       reserve_size, &slot_size, &tsc);
+               if (!buffer)
+                       goto end; /* buffer full */
 
                *to_base = *to = *len = 0;
 
-               ltt_write_event_header(trace, ltt_buf, buffer,
+               buffer = 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 = lttng_param_name;
+                       reserve_size, tsc);
+               *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) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
@@ -1212,4 +1213,8 @@ end:
 #endif //LTT_TRACE
 #endif //LTT_TRACE_FAST
 
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
 #endif //_LTT_FACILITY_USER_GENERIC_H_
This page took 0.107557 seconds and 4 git commands to generate.