X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=probes%2Flttng-events.h;h=596b706085847037d71298c42f7b059b92939da9;hb=29021503335cd774f4f7da3da71f3543cc1df2ec;hp=96062042d038ab4303fd9f2b71fce4401ea33e42;hpb=84da520620463b0168a5ecc750adc5332d857c9c;p=lttng-modules.git diff --git a/probes/lttng-events.h b/probes/lttng-events.h index 96062042..596b7060 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -186,6 +186,10 @@ void trace_##_name(void *__data); #define __field_hex(_type, _item) \ __field_full(_type, _item, __BYTE_ORDER, 16) +#undef __field_oct +#define __field_oct(_type, _item) \ + __field_full(_type, _item, __BYTE_ORDER, 8) + #undef __field_network #define __field_network(_type, _item) \ __field_full(_type, _item, __BIG_ENDIAN, 10) @@ -327,6 +331,7 @@ static void __event_probe__##_name(void *__data); static const struct lttng_event_desc __event_desc___##_map = { \ .fields = __event_fields___##_template, \ .name = #_map, \ + .kname = #_name, \ .probe_callback = (void *) TP_PROBE_CB(_template), \ .nr_fields = ARRAY_SIZE(__event_fields___##_template), \ .owner = THIS_MODULE, \ @@ -690,24 +695,22 @@ __assign_##dest##_3: \ */ #undef tp_copy_string_from_user #define tp_copy_string_from_user(dest, src) \ - __assign_##dest: \ - { \ - size_t __ustrlen; \ - \ - if (0) \ - (void) __typemap.dest; \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest));\ - __ustrlen = __get_dynamic_array_len(dest); \ - if (likely(__ustrlen > 1)) { \ - __chan->ops->event_write_from_user(&__ctx, src, \ - __ustrlen - 1); \ - } \ - __chan->ops->event_memset(&__ctx, 0, 1); \ - } \ +__assign_##dest: \ + if (0) \ + (void) __typemap.dest; \ + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ + __chan->ops->event_strcpy_from_user(&__ctx, src, \ + __get_dynamic_array_len(dest)); \ goto __end_field_##dest; + #undef tp_strcpy #define tp_strcpy(dest, src) \ - tp_memcpy(dest, src, __get_dynamic_array_len(dest)) +__assign_##dest: \ + if (0) \ + (void) __typemap.dest; \ + lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ + __chan->ops->event_strcpy(&__ctx, src, __get_dynamic_array_len(dest)); \ + goto __end_field_##dest; /* Named field types must be defined in lttng-types.h */ @@ -744,6 +747,11 @@ __assign_##dest##_3: \ #define _TP_SESSION_CHECK(session, csession) 1 #endif /* TP_SESSION_CHECK */ +/* + * __dynamic_len array length is twice the number of fields due to + * __dynamic_array_enc_ext_2() and tp_memcpy_dyn_2(), which are the + * worse case, needing 2 entries per field. + */ #undef DECLARE_EVENT_CLASS #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ static void __event_probe__##_name(void *__data, _proto) \ @@ -753,7 +761,7 @@ static void __event_probe__##_name(void *__data, _proto) \ struct lib_ring_buffer_ctx __ctx; \ size_t __event_len, __event_align; \ size_t __dynamic_len_idx = 0; \ - size_t __dynamic_len[ARRAY_SIZE(__event_fields___##_name)]; \ + size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)]; \ struct __event_typemap__##_name __typemap; \ int __ret; \ \