From: Mathieu Desnoyers Date: Wed, 10 Aug 2011 15:13:06 +0000 (-0400) Subject: Build TRACEPOINT_EVENT integer type X-Git-Tag: v1.9.1~308 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1dbfff0c0126804b07e9c11ba2307f65a95a650b;p=lttng-ust.git Build TRACEPOINT_EVENT integer type Signed-off-by: Mathieu Desnoyers --- diff --git a/include/Makefile.am b/include/Makefile.am index 93853642..856be021 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,16 +7,19 @@ nobase_include_HEADERS = \ ust/lttng-events.h \ ust/version.h \ ust/lttng-ust-abi.h \ - ust/ringbuffer-abi.h + ust/ringbuffer-abi.h \ + ust/lttng-tracer.h \ + ust/usterr-signal-safe.h \ + ust/core.h \ + ust/share.h + +# note: usterr-signal-safe.h, core.h and share.h need namespace cleanup. noinst_HEADERS = \ - share.h \ usterr.h \ ust_snprintf.h \ - usterr_signal_safe.h \ ust/compat.h \ ust/config.h \ - ust/core.h \ ust/marker-internal.h \ ust/tracepoint-internal.h \ ust/clock.h \ diff --git a/include/share.h b/include/share.h deleted file mode 100644 index 7bdeb5d2..00000000 --- a/include/share.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 2009 Pierre-Marc Fournier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef UST_SHARE_H -#define UST_SHARE_H - -/* write() */ -#include - -/* send() */ -#include -#include - -#include - -/* This write is patient because it restarts if it was incomplete. - */ - -static __inline__ ssize_t patient_write(int fd, const void *buf, size_t count) -{ - const char *bufc = (const char *) buf; - int result; - - for(;;) { - result = write(fd, bufc, count); - if(result == -1 && errno == EINTR) { - continue; - } - if(result <= 0) { - return result; - } - count -= result; - bufc += result; - - if(count == 0) { - break; - } - } - - return bufc-(const char *)buf; -} - -static __inline__ ssize_t patient_send(int fd, const void *buf, size_t count, int flags) -{ - const char *bufc = (const char *) buf; - int result; - - for(;;) { - result = send(fd, bufc, count, flags); - if(result == -1 && errno == EINTR) { - continue; - } - if(result <= 0) { - return result; - } - count -= result; - bufc += result; - - if(count == 0) { - break; - } - } - - return bufc-(const char *)buf; -} - -#endif /* UST_SHARE_H */ diff --git a/include/ust/lttng-events.h b/include/ust/lttng-events.h index 5ca156b7..b15182c8 100644 --- a/include/ust/lttng-events.h +++ b/include/ust/lttng-events.h @@ -15,12 +15,10 @@ #include #include #include +#include #include #include -#undef is_signed_type -#define is_signed_type(type) (((type)(-1)) < 0) - struct ltt_channel; struct ltt_session; struct lib_ring_buffer_ctx; @@ -57,8 +55,8 @@ struct lttng_enum_entry { .u.basic.integer = \ { \ .size = sizeof(_type) * CHAR_BIT, \ - .alignment = ltt_alignof(_type) * CHAR_BIT, \ - .signedness = is_signed_type(_type), \ + .alignment = lttng_alignof(_type) * CHAR_BIT, \ + .signedness = lttng_is_signed_type(_type), \ .reverse_byte_order = _byte_order != __BYTE_ORDER, \ .base = _base, \ .encoding = lttng_encode_##_encoding, \ @@ -88,8 +86,8 @@ struct lttng_integer_type { .exp_dig = sizeof(_type) * CHAR_BIT \ - _float_mant_dig(_type), \ .mant_dig = _float_mant_dig(_type), \ - .alignment = ltt_alignof(_type) * CHAR_BIT, \ - .signedness = is_signed_type(_type), \ + .alignment = lttng_alignof(_type) * CHAR_BIT, \ + .signedness = lttng_is_signed_type(_type), \ .reverse_byte_order = __BYTE_ORDER != __FLOAT_WORD_ORDER, \ }, \ } \ diff --git a/include/ust/lttng-tracepoint-event.h b/include/ust/lttng-tracepoint-event.h index c006ffd3..70d7c653 100644 --- a/include/ust/lttng-tracepoint-event.h +++ b/include/ust/lttng-tracepoint-event.h @@ -20,6 +20,7 @@ #include #include #include +#include #include /* @@ -90,6 +91,14 @@ /* Helpers */ #define _TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#define _tp_max_t(type, x, y) \ + ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1: __max2; \ + }) + + /* * Stage 1 of the trace events. * @@ -169,7 +178,7 @@ #undef TRACEPOINT_EVENT_CLASS #define TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _fields) \ - TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) + TRACEPOINT_EVENT_CLASS_NOARGS(_name, TP_PARAMS(_fields)) #include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) @@ -261,25 +270,25 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACEPOINT_SYSTEM) = { #undef ctf_integer_ext #define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ - __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \ + __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ __event_len += sizeof(_type); #undef ctf_float #define ctf_float(_type, _item, _src) \ - __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \ + __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ __event_len += sizeof(_type); #undef ctf_array_encoded #define ctf_array_encoded(_type, _item, _src, _length) \ - __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \ + __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ __event_len += sizeof(_type) * (_length); #undef ctf_sequence_encoded #define ctf_sequence_encoded(_type, _item, _src, _length_type, \ _src_length, _encoding) \ - __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_length_type)); \ + __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \ __event_len += sizeof(_length_type); \ - __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \ + __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ __dynamic_len[__dynamic_len_idx] = (_length); \ __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ __dynamic_len_idx++; @@ -335,21 +344,21 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len) \ #undef ctf_integer_ext #define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ - __event_align = max_t(size_t, __event_align, ltt_alignof(_type)); + __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type)); #undef ctf_float #define ctf_float(_type, _item, _src) \ - __event_align = max_t(size_t, __event_align, ltt_alignof(_type)); + __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type)); #undef ctf_array_encoded #define ctf_array_encoded(_type, _item, _src, _length) \ - __event_align = max_t(size_t, __event_align, ltt_alignof(_type)); + __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type)); #undef ctf_sequence_encoded #define ctf_sequence_encoded(_type, _item, _src, _length_type, \ _src_length, _encoding) \ - __event_align = max_t(size_t, __event_align, ltt_alignof(_length_type)); \ - __event_align = max_t(size_t, __event_align, ltt_alignof(_type)); + __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type)); \ + __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type)); #undef ctf_string #define ctf_string(_item, _src) @@ -399,7 +408,7 @@ static inline size_t __event_get_align__##_name(void) \ #define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ { \ _type __tmp = (_src); \ - lib_ring_buffer_align_ctx(&ctx, ltt_alignof(__tmp)); \ + lib_ring_buffer_align_ctx(&ctx, lttng_alignof(__tmp)); \ __chan->ops->event_write(&ctx, &__tmp, sizeof(__tmp)); \ } @@ -407,13 +416,13 @@ static inline size_t __event_get_align__##_name(void) \ #define ctf_float(_type, _item, _src) \ { \ _type __tmp = (_src); \ - lib_ring_buffer_align_ctx(&ctx, ltt_alignof(__tmp)); \ + lib_ring_buffer_align_ctx(&ctx, lttng_alignof(__tmp)); \ __chan->ops->event_write(&ctx, &__tmp, sizeof(__tmp)); \ } #undef ctf_array_encoded #define ctf_array_encoded(_type, _item, _src, _length) \ - lib_ring_buffer_align_ctx(&ctx, ltt_alignof(_type)); \ + lib_ring_buffer_align_ctx(&ctx, lttng_alignof(_type)); \ __chan->ops->event_write(&ctx, _src, _length); #undef ctf_sequence_encoded @@ -421,10 +430,10 @@ static inline size_t __event_get_align__##_name(void) \ _src_length, _encoding) \ { \ _length_type __tmpl = __dynamic_len[__dynamic_len_idx]; \ - lib_ring_buffer_align_ctx(&ctx, ltt_alignof(_length_type)); \ + lib_ring_buffer_align_ctx(&ctx, lttng_alignof(_length_type)); \ __chan->ops->event_write(&ctx, &__tmpl, sizeof(_length_type)); \ } \ - lib_ring_buffer_align_ctx(&ctx, ltt_alignof(_type)); \ + lib_ring_buffer_align_ctx(&ctx, lttng_alignof(_type)); \ __chan->ops->event_write(&ctx, _src, \ sizeof(_type) * __get_sequence_len(dest)); diff --git a/include/ust/share.h b/include/ust/share.h new file mode 100644 index 00000000..7bdeb5d2 --- /dev/null +++ b/include/ust/share.h @@ -0,0 +1,81 @@ +/* Copyright (C) 2009 Pierre-Marc Fournier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef UST_SHARE_H +#define UST_SHARE_H + +/* write() */ +#include + +/* send() */ +#include +#include + +#include + +/* This write is patient because it restarts if it was incomplete. + */ + +static __inline__ ssize_t patient_write(int fd, const void *buf, size_t count) +{ + const char *bufc = (const char *) buf; + int result; + + for(;;) { + result = write(fd, bufc, count); + if(result == -1 && errno == EINTR) { + continue; + } + if(result <= 0) { + return result; + } + count -= result; + bufc += result; + + if(count == 0) { + break; + } + } + + return bufc-(const char *)buf; +} + +static __inline__ ssize_t patient_send(int fd, const void *buf, size_t count, int flags) +{ + const char *bufc = (const char *) buf; + int result; + + for(;;) { + result = send(fd, bufc, count, flags); + if(result == -1 && errno == EINTR) { + continue; + } + if(result <= 0) { + return result; + } + count -= result; + bufc += result; + + if(count == 0) { + break; + } + } + + return bufc-(const char *)buf; +} + +#endif /* UST_SHARE_H */ diff --git a/include/ust/usterr-signal-safe.h b/include/ust/usterr-signal-safe.h new file mode 100644 index 00000000..483e7f54 --- /dev/null +++ b/include/ust/usterr-signal-safe.h @@ -0,0 +1,158 @@ +#ifndef _USTERR_SIGNAL_SAFE_H +#define _USTERR_SIGNAL_SAFE_H + +/* + * Copyright (C) 2009 Pierre-Marc Fournier + * Copyright (C) 2011 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 of + * the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +enum ust_loglevel { + UST_LOGLEVEL_UNKNOWN = 0, + UST_LOGLEVEL_NORMAL, + UST_LOGLEVEL_DEBUG, +}; + +extern volatile enum ust_loglevel ust_loglevel; +void init_usterr(void); + +static inline int ust_debug(void) +{ + return ust_loglevel == UST_LOGLEVEL_DEBUG; +} + +#ifndef UST_COMPONENT +//#error UST_COMPONENT is undefined +#define UST_COMPONENT libust +#endif + +/* To stringify the expansion of a define */ +#define UST_XSTR(d) UST_STR(d) +#define UST_STR(s) #s + +/* We sometimes print in the tracing path, and tracing can occur in + * signal handlers, so we must use a print method which is signal safe. + */ + +extern int ust_safe_snprintf(char *str, size_t n, const char *fmt, ...) + __attribute__ ((format (printf, 3, 4))); + +static inline void __attribute__ ((format (printf, 1, 2))) + __check_ust_safe_fmt(const char *fmt, ...) +{ +} + +#define sigsafe_print_err(fmt, args...) \ +{ \ + /* Can't use dynamic allocation. Limit ourselves to 250 chars. */ \ + char ____buf[250]; \ + int ____saved_errno; \ + \ + /* Save the errno. */ \ + ____saved_errno = errno; \ + \ + ust_safe_snprintf(____buf, sizeof(____buf), fmt, ## args); \ + \ + /* Add end of string in case of buffer overflow. */ \ + ____buf[sizeof(____buf) - 1] = 0; \ + \ + patient_write(STDERR_FILENO, ____buf, strlen(____buf)); \ + /* \ + * Can't print errors because we are in the error printing code \ + * path. \ + */ \ + \ + /* Restore errno, in order to be async-signal safe. */ \ + errno = ____saved_errno; \ +} + +#define UST_STR_COMPONENT UST_XSTR(UST_COMPONENT) + +#define ERRMSG(fmt, args...) \ + do { \ + sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" UST_XSTR(__LINE__) ")\n", \ + (long) getpid(), \ + (long) syscall(SYS_gettid), \ + ## args, __func__); \ + fflush(stderr); \ + } while(0) + +#ifdef UST_DEBUG +# define DBG(fmt, args...) ERRMSG(fmt, ## args) +# define DBG_raw(fmt, args...) \ + do { \ + sigsafe_print_err(fmt, ## args); \ + fflush(stderr); \ + } while(0) +#else +# define DBG(fmt, args...) \ + do { \ + if (ust_debug()) \ + ERRMSG(fmt, ## args); \ + } while (0) +# define DBG_raw(fmt, args...) \ + do { \ + if (ust_debug()) { \ + sigsafe_print_err(fmt, ## args); \ + fflush(stderr); \ + } \ + } while(0) +#endif +#define WARN(fmt, args...) ERRMSG("Warning: " fmt, ## args) +#define ERR(fmt, args...) ERRMSG("Error: " fmt, ## args) +#define BUG(fmt, args...) ERRMSG("BUG: " fmt, ## args) + +#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE) +#define PERROR(call, args...)\ + do { \ + char buf[200] = "Error in strerror_r()"; \ + strerror_r(errno, buf, sizeof(buf)); \ + ERRMSG("Error: " call ": %s", ## args, buf); \ + } while(0); +#else +#define PERROR(call, args...)\ + do { \ + char *buf; \ + char tmp[200]; \ + buf = strerror_r(errno, tmp, sizeof(tmp)); \ + ERRMSG("Error: " call ": %s", ## args, buf); \ + } while(0); +#endif + +#define BUG_ON(condition) \ + do { \ + if (unlikely(condition)) \ + ERR("condition not respected (BUG) on line %s:%d", __FILE__, __LINE__); \ + } while(0) +#define WARN_ON(condition) \ + do { \ + if (unlikely(condition)) \ + WARN("condition not respected on line %s:%d", __FILE__, __LINE__); \ + } while(0) +#define WARN_ON_ONCE(condition) WARN_ON(condition) + +#endif /* _USTERR_SIGNAL_SAFE_H */ diff --git a/include/usterr_signal_safe.h b/include/usterr_signal_safe.h deleted file mode 100644 index 77f9d5fc..00000000 --- a/include/usterr_signal_safe.h +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef _USTERR_SIGNAL_SAFE_H -#define _USTERR_SIGNAL_SAFE_H - -/* - * Copyright (C) 2009 Pierre-Marc Fournier - * Copyright (C) 2011 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; version 2.1 of - * the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include "share.h" - -enum ust_loglevel { - UST_LOGLEVEL_UNKNOWN = 0, - UST_LOGLEVEL_NORMAL, - UST_LOGLEVEL_DEBUG, -}; - -extern volatile enum ust_loglevel ust_loglevel; -void init_usterr(void); - -static inline int ust_debug(void) -{ - return ust_loglevel == UST_LOGLEVEL_DEBUG; -} - -#ifndef UST_COMPONENT -//#error UST_COMPONENT is undefined -#define UST_COMPONENT libust -#endif - -/* To stringify the expansion of a define */ -#define XSTR(d) STR(d) -#define STR(s) #s - -/* We sometimes print in the tracing path, and tracing can occur in - * signal handlers, so we must use a print method which is signal safe. - */ - -extern int ust_safe_snprintf(char *str, size_t n, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); - -static inline void __attribute__ ((format (printf, 1, 2))) - __check_ust_safe_fmt(const char *fmt, ...) -{ -} - -#define sigsafe_print_err(fmt, args...) \ -{ \ - /* Can't use dynamic allocation. Limit ourselves to 250 chars. */ \ - char ____buf[250]; \ - int ____saved_errno; \ - \ - /* Save the errno. */ \ - ____saved_errno = errno; \ - \ - ust_safe_snprintf(____buf, sizeof(____buf), fmt, ## args); \ - \ - /* Add end of string in case of buffer overflow. */ \ - ____buf[sizeof(____buf) - 1] = 0; \ - \ - patient_write(STDERR_FILENO, ____buf, strlen(____buf)); \ - /* \ - * Can't print errors because we are in the error printing code \ - * path. \ - */ \ - \ - /* Restore errno, in order to be async-signal safe. */ \ - errno = ____saved_errno; \ -} - -#define UST_STR_COMPONENT XSTR(UST_COMPONENT) - -#define ERRMSG(fmt, args...) \ - do { \ - sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" XSTR(__LINE__) ")\n", \ - (long) getpid(), \ - (long) syscall(SYS_gettid), \ - ## args, __func__); \ - fflush(stderr); \ - } while(0) - -#ifdef UST_DEBUG -# define DBG(fmt, args...) ERRMSG(fmt, ## args) -# define DBG_raw(fmt, args...) \ - do { \ - sigsafe_print_err(fmt, ## args); \ - fflush(stderr); \ - } while(0) -#else -# define DBG(fmt, args...) \ - do { \ - if (ust_debug()) \ - ERRMSG(fmt, ## args); \ - } while (0) -# define DBG_raw(fmt, args...) \ - do { \ - if (ust_debug()) { \ - sigsafe_print_err(fmt, ## args); \ - fflush(stderr); \ - } \ - } while(0) -#endif -#define WARN(fmt, args...) ERRMSG("Warning: " fmt, ## args) -#define ERR(fmt, args...) ERRMSG("Error: " fmt, ## args) -#define BUG(fmt, args...) ERRMSG("BUG: " fmt, ## args) - -#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE) -#define PERROR(call, args...)\ - do { \ - char buf[200] = "Error in strerror_r()"; \ - strerror_r(errno, buf, sizeof(buf)); \ - ERRMSG("Error: " call ": %s", ## args, buf); \ - } while(0); -#else -#define PERROR(call, args...)\ - do { \ - char *buf; \ - char tmp[200]; \ - buf = strerror_r(errno, tmp, sizeof(tmp)); \ - ERRMSG("Error: " call ": %s", ## args, buf); \ - } while(0); -#endif - -#define BUG_ON(condition) \ - do { \ - if (unlikely(condition)) \ - ERR("condition not respected (BUG) on line %s:%d", __FILE__, __LINE__); \ - } while(0) -#define WARN_ON(condition) \ - do { \ - if (unlikely(condition)) \ - WARN("condition not respected on line %s:%d", __FILE__, __LINE__); \ - } while(0) -#define WARN_ON_ONCE(condition) WARN_ON(condition) - - -#endif /* _USTERR_SIGNAL_SAFE_H */ diff --git a/libringbuffer/frontend_types.h b/libringbuffer/frontend_types.h index 59611f2f..28179dfc 100644 --- a/libringbuffer/frontend_types.h +++ b/libringbuffer/frontend_types.h @@ -23,7 +23,7 @@ #include "ust/core.h" -#include "usterr_signal_safe.h" +#include #include #include "backend_types.h" #include "shm.h" diff --git a/libringbuffer/shm.h b/libringbuffer/shm.h index 4e9ced19..71624e39 100644 --- a/libringbuffer/shm.h +++ b/libringbuffer/shm.h @@ -10,8 +10,8 @@ */ #include +#include #include "ust/core.h" -#include "usterr_signal_safe.h" #define SHM_MAGIC 0x54335433 #define SHM_MAJOR 0 diff --git a/libust/buffers.c b/libust/buffers.c index c4eddb06..5e67d544 100644 --- a/libust/buffers.c +++ b/libust/buffers.c @@ -40,7 +40,7 @@ #include "channels.h" #include "tracer.h" #include "tracercore.h" -#include "usterr_signal_safe.h" +#include struct ltt_reserve_switch_offsets { long begin, end, old; diff --git a/libust/ltt-context.c b/libust/ltt-context.c index fc0eb7ef..83aa2975 100644 --- a/libust/ltt-context.c +++ b/libust/ltt-context.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include /* * Note: as we append context information, the pointer location may change. diff --git a/libust/ltt-events.c b/libust/ltt-events.c index e4ffc69a..ece959b3 100644 --- a/libust/ltt-events.c +++ b/libust/ltt-events.c @@ -21,7 +21,7 @@ #include #include #include -#include "usterr_signal_safe.h" +#include #include "ust/core.h" #include "ltt-tracer.h" #include "ust/wait.h" @@ -753,8 +753,8 @@ int _ltt_event_header_declare(struct ltt_session *session) " } extended;\n" " } v;\n" "} align(%u);\n\n", - ltt_alignof(uint32_t) * CHAR_BIT, - ltt_alignof(uint16_t) * CHAR_BIT + lttng_alignof(uint32_t) * CHAR_BIT, + lttng_alignof(uint16_t) * CHAR_BIT ); } @@ -805,10 +805,10 @@ int _ltt_session_metadata_statedump(struct ltt_session *session) " uint32_t stream_id;\n" " };\n" "};\n\n", - ltt_alignof(uint8_t) * CHAR_BIT, - ltt_alignof(uint16_t) * CHAR_BIT, - ltt_alignof(uint32_t) * CHAR_BIT, - ltt_alignof(uint64_t) * CHAR_BIT, + lttng_alignof(uint8_t) * CHAR_BIT, + lttng_alignof(uint16_t) * CHAR_BIT, + lttng_alignof(uint32_t) * CHAR_BIT, + lttng_alignof(uint64_t) * CHAR_BIT, CTF_VERSION_MAJOR, CTF_VERSION_MINOR, uuid_s, diff --git a/libust/ltt-ring-buffer-client.h b/libust/ltt-ring-buffer-client.h index 2a187c71..dce34aa2 100644 --- a/libust/ltt-ring-buffer-client.h +++ b/libust/ltt-ring-buffer-client.h @@ -105,7 +105,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config, switch (ltt_chan->header_type) { case 1: /* compact */ - padding = lib_ring_buffer_align(offset, ltt_alignof(uint32_t)); + padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t)); offset += padding; if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) { offset += sizeof(uint32_t); /* id and timestamp */ @@ -113,24 +113,24 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config, /* Minimum space taken by 5-bit id */ offset += sizeof(uint8_t); /* Align extended struct on largest member */ - offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t)); + offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t)); offset += sizeof(uint32_t); /* id */ - offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t)); + offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t)); offset += sizeof(uint64_t); /* timestamp */ } break; case 2: /* large */ - padding = lib_ring_buffer_align(offset, ltt_alignof(uint16_t)); + padding = lib_ring_buffer_align(offset, lttng_alignof(uint16_t)); offset += padding; offset += sizeof(uint16_t); if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) { - offset += lib_ring_buffer_align(offset, ltt_alignof(uint32_t)); + offset += lib_ring_buffer_align(offset, lttng_alignof(uint32_t)); offset += sizeof(uint32_t); /* timestamp */ } else { /* Align extended struct on largest member */ - offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t)); + offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t)); offset += sizeof(uint32_t); /* id */ - offset += lib_ring_buffer_align(offset, ltt_alignof(uint64_t)); + offset += lib_ring_buffer_align(offset, lttng_alignof(uint64_t)); offset += sizeof(uint64_t); /* timestamp */ } break; @@ -188,7 +188,7 @@ void ltt_write_event_header(const struct lib_ring_buffer_config *config, uint16_t id = event_id; lib_ring_buffer_write(config, ctx, &id, sizeof(id)); - lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint32_t)); + lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint32_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); break; } @@ -228,9 +228,9 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, bt_bitfield_write(&id, uint8_t, 0, 5, 31); lib_ring_buffer_write(config, ctx, &id, sizeof(id)); /* Align extended struct on largest member */ - lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t)); + lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); - lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t)); + lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } break; @@ -241,7 +241,7 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, uint16_t id = event_id; lib_ring_buffer_write(config, ctx, &id, sizeof(id)); - lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint32_t)); + lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint32_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } else { uint16_t id = 65535; @@ -249,9 +249,9 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, lib_ring_buffer_write(config, ctx, &id, sizeof(id)); /* Align extended struct on largest member */ - lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t)); + lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); - lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t)); + lib_ring_buffer_align_ctx(ctx, lttng_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } break; diff --git a/libust/ltt-tracer-core.h b/libust/ltt-tracer-core.h index abab1734..c7936827 100644 --- a/libust/ltt-tracer-core.h +++ b/libust/ltt-tracer-core.h @@ -23,15 +23,11 @@ #include #include +#include #include - -#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS -/* Align data on its natural alignment */ -#define RING_BUFFER_ALIGN -#endif - -#include "usterr_signal_safe.h" +#include #include "ust/bug.h" + #include struct ltt_session; diff --git a/libust/ltt-tracer.h b/libust/ltt-tracer.h index a79c5f76..f7768393 100644 --- a/libust/ltt-tracer.h +++ b/libust/ltt-tracer.h @@ -30,24 +30,10 @@ #include #include "ltt-tracer-core.h" -#define LTTNG_UST_VERSION 0 -#define LTTNG_UST_PATCHLEVEL 9 -#define LTTNG_UST_SUBLEVEL 1 - -#ifndef CHAR_BIT -#define CHAR_BIT 8 -#endif - /* Number of bytes to log with a read/write event */ #define LTT_LOG_RW_SIZE 32L #define LTT_MAX_SMALL_SIZE 0xFFFFU -#ifdef RING_BUFFER_ALIGN -#define ltt_alignof(type) __alignof__(type) -#else -#define ltt_alignof(type) 1 -#endif - /* Tracer properties */ #define CTF_MAGIC_NUMBER 0xC1FC1FC1 #define TSDL_MAGIC_NUMBER 0x75D11D57 diff --git a/libust/lttng-ust-abi.c b/libust/lttng-ust-abi.c index ad582c05..3674dcc3 100644 --- a/libust/lttng-ust-abi.c +++ b/libust/lttng-ust-abi.c @@ -28,7 +28,7 @@ #include #include #include -#include "usterr_signal_safe.h" +#include #include "ust/core.h" #include "ltt-tracer.h" diff --git a/libust/tracepoint.c b/libust/tracepoint.c index 67619a85..6eb40ea2 100644 --- a/libust/tracepoint.c +++ b/libust/tracepoint.c @@ -28,7 +28,7 @@ #include #include -#include "usterr_signal_safe.h" +#include extern struct tracepoint * const __start___tracepoints_ptrs[] __attribute__((visibility("hidden"))); diff --git a/libust/ust-core.c b/libust/ust-core.c index 7791ffb0..cb87b745 100644 --- a/libust/ust-core.c +++ b/libust/ust-core.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include volatile enum ust_loglevel ust_loglevel; diff --git a/tests/hello/tp.h b/tests/hello/tp.h index 606f0f13..7fa16e90 100644 --- a/tests/hello/tp.h +++ b/tests/hello/tp.h @@ -25,9 +25,11 @@ #include TRACEPOINT_EVENT(ust_tests_hello_tptest, - TP_PROTO(int anint), - TP_ARGS(anint), - TP_FIELDS()) + TP_PROTO(int anint), + TP_ARGS(anint), + TP_FIELDS( + ctf_integer(int, intfield, anint) + )) TRACEPOINT_EVENT_NOARGS(ust_tests_hello_tptest_sighandler, TP_FIELDS())