From a60d70e608a727038ebc27e493aac65b49932146 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 17 Nov 2011 12:02:48 -0500 Subject: [PATCH] Remove all LGPL-licensed headers Remove all headers licensed under LGPLv2.1 for upcoming reimplementation under the BSD-style MIT license. Even though technically most of the content of these headers fall under the exceptions of the LGPL: "When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)" Our intent is to make sure applications can include these headers without having to be considered derived code. Therefore, the license of align.h, bug.h, ringbuffer-abi.h and ringbuffer-config.h, ust-abi.h, ust-events.h, vatomic.h are changed to MIT license (I, Mathieu Desnoyers, am the sole author of these files and agree to these changes). I am removing tracepoint-event.h, tracepoint-internal.h, tracepoint-types.h, tracepoint.h, ust-tracepoint-event-reset.h and ust-tracepoint-event.h because those might be considered derived work from Ftrace. Signed-off-by: Mathieu Desnoyers --- include/lttng/align.h | 9 +- include/lttng/bug.h | 10 +- include/lttng/ringbuffer-abi.h | 9 +- include/lttng/ringbuffer-config.h | 9 +- include/lttng/tracepoint-event.h | 123 ----- include/lttng/tracepoint-internal.h | 85 ---- include/lttng/tracepoint-types.h | 45 -- include/lttng/tracepoint.h | 465 ------------------- include/lttng/ust-abi.h | 9 +- include/lttng/ust-events.h | 11 +- include/lttng/ust-tracepoint-event-reset.h | 37 -- include/lttng/ust-tracepoint-event.h | 507 --------------------- include/lttng/vatomic.h | 9 +- lgpl-relicensing.txt | 23 - 14 files changed, 58 insertions(+), 1293 deletions(-) delete mode 100644 include/lttng/tracepoint-event.h delete mode 100644 include/lttng/tracepoint-internal.h delete mode 100644 include/lttng/tracepoint-types.h delete mode 100644 include/lttng/tracepoint.h delete mode 100644 include/lttng/ust-tracepoint-event-reset.h delete mode 100644 include/lttng/ust-tracepoint-event.h delete mode 100644 lgpl-relicensing.txt diff --git a/include/lttng/align.h b/include/lttng/align.h index 12fc61b9..94d0d6e3 100644 --- a/include/lttng/align.h +++ b/include/lttng/align.h @@ -6,7 +6,14 @@ * * (C) Copyright 2010-2011 - Mathieu Desnoyers * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #include diff --git a/include/lttng/bug.h b/include/lttng/bug.h index 96007c3f..ebae9b74 100644 --- a/include/lttng/bug.h +++ b/include/lttng/bug.h @@ -6,7 +6,15 @@ * * (C) Copyright 2010-2011 - Mathieu Desnoyers * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * */ #define BUILD_BUG_ON(condition) \ diff --git a/include/lttng/ringbuffer-abi.h b/include/lttng/ringbuffer-abi.h index 25bc194b..da6f813a 100644 --- a/include/lttng/ringbuffer-abi.h +++ b/include/lttng/ringbuffer-abi.h @@ -11,7 +11,14 @@ * Author: * Mathieu Desnoyers * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #define _UST_CMD(minor) (minor) diff --git a/include/lttng/ringbuffer-config.h b/include/lttng/ringbuffer-config.h index b377b9b3..60124c60 100644 --- a/include/lttng/ringbuffer-config.h +++ b/include/lttng/ringbuffer-config.h @@ -9,7 +9,14 @@ * Ring buffer configuration header. Note: after declaring the standard inline * functions, clients should also include linux/ringbuffer/api.h. * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #include diff --git a/include/lttng/tracepoint-event.h b/include/lttng/tracepoint-event.h deleted file mode 100644 index b47bf6a7..00000000 --- a/include/lttng/tracepoint-event.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2009 Steven Rostedt - * 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 - * - * - * Trace files that want to automate creationg of all tracepoints defined - * in their file should include this file. The following are macros that the - * trace file may define: - * - * TRACEPOINT_PROVIDER defines the provider the tracepoint is for: - * < [com_company_]project_[component_] > - * - * TRACEPOINT_INCLUDE_FILE if the file name is something other than - * TRACEPOINT_PROVIDER.h. This macro may be defined to tell - * define_trace.h what file to include. Note, leave off the ".h". - * - * TRACEPOINT_INCLUDE_PATH if the path is something other than within - * the system's include/tracepoint/ path, then this macro can define - * the path to use. This path is relative to tracepoint-event.h, or - * to the include search path. Trick: Use a - * #define TRACEPOINT_INCLUDE_PATH . - * combined with -Ipath_to_header as compiler argument to allow - * searching for a header within your project build tree. - * - * Note considering licensing: - * - * Including the tracepoint-event.h header without the - * TRACEPOINT_CREATE_PROBES macro defined is fine within any application - * source code, even for non-LGPL-compatible applications. - * - * However, TRACEPOINT_CREATE_PROBES should only be defined within - * LGPL-compatible C files. This means that the tracepoint probe object - * should be relinkable when distributed, either by providing it as a - * dynamically linkable shared object (.so library), or by providing the - * build scripts and object files required to relink the object if - * statically linked. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef TRACEPOINT_CREATE_PROBES - -/* Prevent recursion */ -#undef TRACEPOINT_CREATE_PROBES - -#ifndef __tp_stringify -#define __tp_stringify_1(x...) #x -#define __tp_stringify(x...) __tp_stringify_1(x) -#endif - -#undef TRACEPOINT_EVENT -#define TRACEPOINT_EVENT(provider, name, args, fields) \ - _DEFINE_TRACEPOINT(provider, name) - -#undef TRACEPOINT_EVENT_INSTANCE -#define TRACEPOINT_EVENT_INSTANCE(provider, template, name, args) \ - _DEFINE_TRACEPOINT(provider, name) - -#undef TRACEPOINT_INCLUDE -#undef __TRACEPOINT_INCLUDE - -#ifndef TRACEPOINT_INCLUDE_FILE -# define TRACEPOINT_INCLUDE_FILE TRACEPOINT_PROVIDER -# define UNDEF_TRACEPOINT_INCLUDE_FILE -#endif - -#ifndef TRACEPOINT_INCLUDE_PATH -# define __TRACEPOINT_INCLUDE(provider) -# define UNDEF_TRACEPOINT_INCLUDE_PATH -#else -# define __TRACEPOINT_INCLUDE(provider) \ - __tp_stringify(TRACEPOINT_INCLUDE_PATH/provider.h) -#endif - -# define TRACEPOINT_INCLUDE(provider) __TRACEPOINT_INCLUDE(provider) - -/* Let the trace headers be reread */ -#define TRACEPOINT_HEADER_MULTI_READ - -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) - -#include - -#undef TRACEPOINT_EVENT -#undef TRACEPOINT_EVENT_CLASS -#undef TRACEPOINT_EVENT_INSTANCE -#undef TRACEPOINT_HEADER_MULTI_READ - -/* Only undef what we defined in this file */ -#ifdef UNDEF_TRACEPOINT_INCLUDE_FILE -# undef TRACEPOINT_INCLUDE_FILE -# undef UNDEF_TRACEPOINT_INCLUDE_FILE -#endif - -#ifdef UNDEF_TRACEPOINT_INCLUDE_PATH -# undef TRACEPOINT_INCLUDE_PATH -# undef UNDEF_TRACEPOINT_INCLUDE_PATH -#endif - -/* We may be processing more files */ -#define TRACEPOINT_CREATE_PROBES - -#endif /* TRACEPOINT_CREATE_PROBES */ - -#ifdef __cplusplus -} -#endif diff --git a/include/lttng/tracepoint-internal.h b/include/lttng/tracepoint-internal.h deleted file mode 100644 index 54278c8f..00000000 --- a/include/lttng/tracepoint-internal.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef _LTTNG_TRACEPOINT_INTERNAL_H -#define _LTTNG_TRACEPOINT_INTERNAL_H - -/* - * tracepoint-internal.h - * - * Tracepoint internal header. - * - * Copyright (C) 2008 Mathieu Desnoyers - * Copyright (C) 2009 Pierre-Marc Fournier - * Copyright (C) 2009 Steven Rostedt - * - * 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 - * - * Heavily inspired from the Linux Kernel Markers. - */ - -#include -#include -#include -#include - -struct tracepoint_lib { - struct tracepoint * const *tracepoints_start; - int tracepoints_count; - struct cds_list_head list; -}; - -extern int tracepoint_probe_register_noupdate(const char *name, void *probe, - void *data); -extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe, - void *data); -extern void tracepoint_probe_update_all(void); - -struct tracepoint_iter { - struct tracepoint_lib *lib; - struct tracepoint * const *tracepoint; -}; - -extern void tracepoint_iter_start(struct tracepoint_iter *iter); -extern void tracepoint_iter_next(struct tracepoint_iter *iter); -extern void tracepoint_iter_stop(struct tracepoint_iter *iter); -extern void tracepoint_iter_reset(struct tracepoint_iter *iter); -extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint, - struct tracepoint * const *begin, struct tracepoint * const *end); - -/* - * tracepoint_synchronize_unregister must be called between the last tracepoint - * probe unregistration and the end of module exit to make sure there is no - * caller executing a probe when it is freed. - */ -static inline void tracepoint_synchronize_unregister(void) -{ - synchronize_rcu(); -} - -struct trace_event_iter { - struct trace_event_lib *lib; - struct trace_event * const *trace_event; -}; - -extern void trace_event_iter_start(struct trace_event_iter *iter); -extern void trace_event_iter_next(struct trace_event_iter *iter); -extern void trace_event_iter_stop(struct trace_event_iter *iter); -extern void trace_event_iter_reset(struct trace_event_iter *iter); - -extern void trace_event_update_process(void); -extern int is_trace_event_enabled(const char *channel, const char *name); - -extern void init_tracepoint(void); -extern void exit_tracepoint(void); - -#endif /* _LTTNG_TRACEPOINT_INTERNAL_H */ diff --git a/include/lttng/tracepoint-types.h b/include/lttng/tracepoint-types.h deleted file mode 100644 index 5f387086..00000000 --- a/include/lttng/tracepoint-types.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _LTTNG_TRACEPOINT_TYPES_H -#define _LTTNG_TRACEPOINT_TYPES_H - -/* - * Copyright (C) 2008-2011 Mathieu Desnoyers - * Copyright (C) 2009 Pierre-Marc Fournier - * Copyright (C) 2009 Steven Rostedt - * - * 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 - * - * Heavily inspired from the Linux Kernel Markers. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -struct tracepoint_probe { - void *func; - void *data; -}; - -struct tracepoint { - const char *name; /* Tracepoint name */ - char state; /* State. */ - struct tracepoint_probe *probes; -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _LTTNG_TRACEPOINT_TYPES_H */ diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h deleted file mode 100644 index 8e3b6044..00000000 --- a/include/lttng/tracepoint.h +++ /dev/null @@ -1,465 +0,0 @@ -#ifndef _LTTNG_TRACEPOINT_H -#define _LTTNG_TRACEPOINT_H - -/* - * Copyright (C) 2008-2011 Mathieu Desnoyers - * Copyright (C) 2009 Pierre-Marc Fournier - * Copyright (C) 2009 Steven Rostedt - * - * 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 - * - * Heavily inspired from the Linux Kernel Markers. - */ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Tracepoints should be added to the instrumented code using the - * "tracepoint()" macro. - */ -#define tracepoint(provider, name, args...) \ - do { \ - if (caa_unlikely(__tracepoint_##provider##___##name.state)) \ - __trace_##provider##___##name(args); \ - } while (0) - -/* - * it_func[0] is never NULL because there is at least one element in the array - * when the array itself is non NULL. - */ -#define __DO_TRACE(tp, proto, vars) \ - do { \ - struct tracepoint_probe *__tp_it_probe_ptr; \ - void *__tp_it_func; \ - void *__tp_cb_data; \ - \ - rcu_read_lock(); \ - __tp_it_probe_ptr = rcu_dereference((tp)->probes); \ - if (__tp_it_probe_ptr) { \ - do { \ - __tp_it_func = __tp_it_probe_ptr->func; \ - __tp_cb_data = __tp_it_probe_ptr->data; \ - URCU_FORCE_CAST(void(*)(proto), __tp_it_func)(vars); \ - } while ((++__tp_it_probe_ptr)->func); \ - } \ - rcu_read_unlock(); \ - } while (0) - -#define TP_PARAMS(args...) args -#define TP_ARGS(args...) args - -/* - * TP_ARGS takes tuples of type, argument separated by a comma. It can - * take up to 10 tuples (which means that less than 10 tuples is fine - * too). Each tuple is also separated by a comma. - */ - -#define TP_COMBINE_TOKENS1(_tokena, _tokenb) _tokena##_tokenb -#define TP_COMBINE_TOKENS(_tokena, _tokenb) TP_COMBINE_TOKENS1(_tokena, _tokenb) - -/* _TP_EVEN* extracts the vars names. */ -/* 0 and 1 are for void */ -#define _TP_EVEN0() -#define _TP_EVEN1(a) -#define _TP_EVEN2(a,b) b -#define _TP_EVEN4(a,b,c,d) b,d -#define _TP_EVEN6(a,b,c,d,e,f) b,d,f -#define _TP_EVEN8(a,b,c,d,e,f,g,h) b,d,f,h -#define _TP_EVEN10(a,b,c,d,e,f,g,h,i,j) b,d,f,h,j -#define _TP_EVEN12(a,b,c,d,e,f,g,h,i,j,k,l) b,d,f,h,j,l -#define _TP_EVEN14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) b,d,f,h,j,l,n -#define _TP_EVEN16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) b,d,f,h,j,l,n,p -#define _TP_EVEN18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) b,d,f,h,j,l,n,p,r -#define _TP_EVEN20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) b,d,f,h,j,l,n,p,r,t - -/* 0 and 1 are for void */ -#define _TP_EVEN_DATA0() __tp_cb_data -#define _TP_EVEN_DATA1(a) __tp_cb_data -#define _TP_EVEN_DATA2(a,b) __tp_cb_data,b -#define _TP_EVEN_DATA4(a,b,c,d) __tp_cb_data,b,d -#define _TP_EVEN_DATA6(a,b,c,d,e,f) __tp_cb_data,b,d,f -#define _TP_EVEN_DATA8(a,b,c,d,e,f,g,h) __tp_cb_data,b,d,f,h -#define _TP_EVEN_DATA10(a,b,c,d,e,f,g,h,i,j) __tp_cb_data,b,d,f,h,j -#define _TP_EVEN_DATA12(a,b,c,d,e,f,g,h,i,j,k,l) __tp_cb_data,b,d,f,h,j,l -#define _TP_EVEN_DATA14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) __tp_cb_data,b,d,f,h,j,l,n -#define _TP_EVEN_DATA16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) __tp_cb_data,b,d,f,h,j,l,n,p -#define _TP_EVEN_DATA18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) __tp_cb_data,b,d,f,h,j,l,n,p,r -#define _TP_EVEN_DATA20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) __tp_cb_data,b,d,f,h,j,l,n,p,r,t - -/* _TP_SPLIT extracts tuples of type, var */ -/* 0 and 1 are for void */ -#define _TP_SPLIT0() -#define _TP_SPLIT1(a) -#define _TP_SPLIT2(a,b) a b -#define _TP_SPLIT4(a,b,c,d) a b,c d -#define _TP_SPLIT6(a,b,c,d,e,f) a b,c d,e f -#define _TP_SPLIT8(a,b,c,d,e,f,g,h) a b,c d,e f,g h -#define _TP_SPLIT10(a,b,c,d,e,f,g,h,i,j) a b,c d,e f,g h,i j -#define _TP_SPLIT12(a,b,c,d,e,f,g,h,i,j,k,l) a b,c d,e f,g h,i j,k l -#define _TP_SPLIT14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) a b,c d,e f,g h,i j,k l,m n -#define _TP_SPLIT16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) a b,c d,e f,g h,i j,k l,m n,o p -#define _TP_SPLIT18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) a b,c d,e f,g h,i j,k l,m n,o p,q r -#define _TP_SPLIT20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) a b,c d,e f,g h,i j,k l,m n,o p,q r,s t - -/* 0 and 1 are for void */ -#define _TP_SPLIT_DATA0() void *__tp_cb_data -#define _TP_SPLIT_DATA1(a) void *__tp_cb_data -#define _TP_SPLIT_DATA2(a,b) void *__tp_cb_data,a b -#define _TP_SPLIT_DATA4(a,b,c,d) void *__tp_cb_data,a b,c d -#define _TP_SPLIT_DATA6(a,b,c,d,e,f) void *__tp_cb_data,a b,c d,e f -#define _TP_SPLIT_DATA8(a,b,c,d,e,f,g,h) void *__tp_cb_data,a b,c d,e f,g h -#define _TP_SPLIT_DATA10(a,b,c,d,e,f,g,h,i,j) void *__tp_cb_data,a b,c d,e f,g h,i j -#define _TP_SPLIT_DATA12(a,b,c,d,e,f,g,h,i,j,k,l) void *__tp_cb_data,a b,c d,e f,g h,i j,k l -#define _TP_SPLIT_DATA14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n -#define _TP_SPLIT_DATA16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n,o p -#define _TP_SPLIT_DATA18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n,o p,q r -#define _TP_SPLIT_DATA20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n,o p,q r,s t - -/* Preprocessor trick to count arguments. Inspired from sdt.h. */ -#define _TP_NARGS(...) __TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) -#define __TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N -#define _TP_PROTO_N(N, ...) \ - TP_PARAMS(TP_COMBINE_TOKENS(_TP_SPLIT, N)(__VA_ARGS__)) -#define _TP_VARS_N(N, ...) \ - TP_PARAMS(TP_COMBINE_TOKENS(_TP_EVEN, N)(__VA_ARGS__)) -#define _TP_PROTO_DATA_N(N, ...) \ - TP_PARAMS(TP_COMBINE_TOKENS(_TP_SPLIT_DATA, N)(__VA_ARGS__)) -#define _TP_VARS_DATA_N(N, ...) \ - TP_PARAMS(TP_COMBINE_TOKENS(_TP_EVEN_DATA, N)(__VA_ARGS__)) - -#define _TP_ARGS_PROTO(...) _TP_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) -#define _TP_ARGS_VARS(...) _TP_VARS_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) - -#define _TP_ARGS_PROTO_DATA(...) _TP_PROTO_DATA_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) -#define _TP_ARGS_VARS_DATA(...) _TP_VARS_DATA_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) - -/* - * Make sure the alignment of the structure in the __tracepoints section will - * not add unwanted padding between the beginning of the section and the - * structure. Force alignment to the same alignment as the section start. - */ -#define __DECLARE_TRACEPOINT(provider, name, proto, args, data_proto, data_args) \ - extern struct tracepoint __tracepoint_##provider##___##name; \ - static inline void __trace_##provider##___##name(proto) \ - { \ - __DO_TRACE(&__tracepoint_##provider##___##name, \ - TP_PARAMS(data_proto), TP_PARAMS(data_args)); \ - } \ - static inline int \ - __register_trace_##provider##___##name(void (*probe)(data_proto), void *data) \ - { \ - return __tracepoint_probe_register(#provider ":" #name, (void *) probe, \ - data); \ - } \ - static inline int \ - __unregister_trace_##provider##___##name(void (*probe)(data_proto), void *data) \ - { \ - return __tracepoint_probe_unregister(#provider ":" #name, (void *) probe, \ - data); \ - } - -#define _DECLARE_TRACEPOINT(provider, name, args) \ - __DECLARE_TRACEPOINT(provider, name, _TP_ARGS_PROTO(args), _TP_ARGS_VARS(args), \ - _TP_ARGS_PROTO_DATA(args), _TP_ARGS_VARS_DATA(args)) - -/* - * __tracepoints_ptrs section is not const (read-only) to let the linker update - * the pointer, allowing PIC code. - */ -#define _DEFINE_TRACEPOINT(provider, name) \ - static const char __tpstrtab_##provider##___##name[] \ - __attribute__((section("__tracepoints_strings"))) = \ - #provider ":" #name; \ - struct tracepoint __tracepoint_##provider##___##name \ - __attribute__((section("__tracepoints"))) = \ - { __tpstrtab_##provider##___##name, 0, NULL }; \ - static struct tracepoint * __tracepoint_ptr_##provider##___##name \ - __attribute__((used, section("__tracepoints_ptrs"))) = \ - &__tracepoint_##provider##___##name; - - -#define __register_tracepoint(provider, name, probe, data) \ - __register_trace_##provider##___##name(probe, data) -#define __unregister_tracepoint(provider, name, probe, data) \ - __unregister_trace_##provider##___##name(probe, data) - -/* - * Connect a probe to a tracepoint. - * Internal API. - */ -extern -int __tracepoint_probe_register(const char *name, void *probe, void *data); - -/* - * Disconnect a probe from a tracepoint. - * Internal API. - */ -extern -int __tracepoint_probe_unregister(const char *name, void *probe, void *data); - -extern -int tracepoint_register_lib(struct tracepoint * const *tracepoints_start, - int tracepoints_count); -extern -int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start); - -/* - * These weak symbols, the constructor, and destructor take care of - * registering only _one_ instance of the tracepoints per shared-ojbect - * (or for the whole main program). - */ -extern struct tracepoint * const __start___tracepoints_ptrs[] - __attribute__((weak, visibility("hidden"))); -extern struct tracepoint * const __stop___tracepoints_ptrs[] - __attribute__((weak, visibility("hidden"))); -int __tracepoint_registered - __attribute__((weak, visibility("hidden"))); - -static void __attribute__((constructor)) __tracepoints__init(void) -{ - if (__tracepoint_registered++) - return; - tracepoint_register_lib(__start___tracepoints_ptrs, - __stop___tracepoints_ptrs - - __start___tracepoints_ptrs); -} - -static void __attribute__((destructor)) __tracepoints__destroy(void) -{ - if (--__tracepoint_registered) - return; - tracepoint_unregister_lib(__start___tracepoints_ptrs); -} - -#ifdef __cplusplus -} -#endif - -#endif /* _LTTNG_TRACEPOINT_H */ - -/* - * For multiple probe generation, we need to redefine TRACEPOINT_EVENT - * each time tracepoint.h is included. - */ - -#ifndef TRACEPOINT_EVENT -/* - * Usage of the TRACEPOINT_EVENT macro: - * - * In short, an example: - * - * TRACEPOINT_EVENT(< [com_company_]project[_component] >, < event >, - * - * * TP_ARGS takes from 0 to 10 "type, field_name" pairs * - * - * TP_ARGS(int, arg0, void *, arg1, char *, string, size_t, strlen, - * long *, arg4, size_t, arg4_len), - * TP_FIELDS( - * - * * Integer, printed in base 10 * - * ctf_integer(int, field_a, arg0) - * - * * Integer, printed with 0x base 16 * - * ctf_integer_hex(unsigned long, field_d, arg1) - * - * * Array Sequence, printed as UTF8-encoded array of bytes * - * ctf_array_text(char, field_b, string, FIXED_LEN) - * ctf_sequence_text(char, field_c, string, size_t, strlen) - * - * * String, printed as UTF8-encoded string * - * ctf_string(field_e, string) - * - * * Array sequence of signed integer values * - * ctf_array(long, field_f, arg4, FIXED_LEN4) - * ctf_sequence(long, field_g, arg4, size_t, arg4_len) - * ) - * ) - * - * In more detail: - * - * We define a tracepoint, its arguments, and its 'fast binary record' - * layout. - * - * Firstly, name your tracepoint via TRACEPOINT_EVENT(provider, name, - * - * The provider and name should be a proper C99 identifier. - * The "provider" and "name" MUST follow these rules to ensure no - * namespace clash occurs: - * - * For projects (applications and libraries) for which an entity - * specific to the project controls the source code and thus its - * tracepoints (typically with a scope larger than a single company): - * - * either: - * project_component, event - * or: - * project, event - * - * Where "project" is the name of the project, - * "component" is the name of the project component (which may - * include several levels of sub-components, e.g. - * ...component_subcomponent_...) where the tracepoint is located - * (optional), - * "event" is the name of the tracepoint event. - * - * For projects issued from a single company wishing to advertise that - * the company controls the source code and thus the tracepoints, the - * "com_" prefix should be used: - * - * either: - * com_company_project_component, event - * or: - * com_company_project, event - * - * Where "company" is the name of the company, - * "project" is the name of the project, - * "component" is the name of the project component (which may - * include several levels of sub-components, e.g. - * ...component_subcomponent_...) where the tracepoint is located - * (optional), - * "event" is the name of the tracepoint event. - * - * the provider:event identifier is limited to 127 characters. - * - * As an example, let's consider a user-space application "someproject" - * that would have an internal thread scheduler: - * - * TRACEPOINT_EVENT(someproject_sched, switch, - * - * * - * * Arguments to pass to the tracepoint. Supports from - * * 0 to 10 "type, name" tuples. - * * - * - * TP_ARGS(struct rq *, rq, struct task_struct *, prev, - * struct task_struct *, next), - * - * * - * * Fast binary tracing: define the trace record via - * * TP_FIELDS(). You can think about it like a - * * regular C structure local variable definition. - * * - * * This is how the trace record is structured and will - * * be saved into the ring buffer. These are the fields - * * that will be exposed to readers. - * * - * * ctf_integer(pid_t, prev_pid, prev->pid) is equivalent - * * to a standard declaraton: - * * - * * pid_t prev_pid; - * * - * * followed by an assignment: - * * - * * prev_pid = prev->pid; - * * - * * ctf_array(char, prev_comm, prev->comm, TASK_COMM_LEN) is - * * equivalent to: - * * - * * char prev_comm[TASK_COMM_LEN]; - * * - * * followed by an assignment: - * * - * * memcpy(prev_comm, prev->comm, TASK_COMM_LEN); - * * - * - * TP_FIELDS( - * ctf_array(char, prev_comm, prev->comm, TASK_COMM_LEN) - * ctf_integer(pid_t, prev_pid, prev->pid) - * ctf_integer(int, prev_prio, prev->prio) - * ctf_array(char, next_comm, next->comm, TASK_COMM_LEN) - * ctf_integer(pid_t, next_pid, next->pid) - * ctf_integer(int, next_prio, next->prio) - * ) - * ) - * - * Do _NOT_ add comma (,) nor semicolon (;) after the TRACEPOINT_EVENT - * declaration. - * - * The TRACEPOINT_PROVIDER must be defined when declaring a - * TRACEPOINT_EVENT. See ust/tracepoint-event.h for information about - * usage of other macros controlling TRACEPOINT_EVENT. - */ - -#define TRACEPOINT_EVENT(provider, name, args, fields) \ - _DECLARE_TRACEPOINT(provider, name, TP_PARAMS(args)) - -#define TRACEPOINT_EVENT_CLASS(provider, name, args, fields) -#define TRACEPOINT_EVENT_INSTANCE(provider, template, name, args)\ - _DECLARE_TRACEPOINT(provider, name, TP_PARAMS(args)) - -#endif /* #ifndef TRACEPOINT_EVENT */ - -#ifndef TRACEPOINT_LOGLEVEL - -/* - * Tracepoint Loglevel Declaration Facility - * - * This is a place-holder the tracepoint loglevel declaration, - * overridden by the tracer implementation. - * - * Typical use of these loglevels: - * - * 1) Declare the mapping between loglevel names and an integer values - * within TRACEPOINT_LOGLEVEL_ENUM, using TP_LOGLEVEL for each tuple. - * Do _NOT_ add comma (,) nor semicolon (;) between the - * TRACEPOINT_LOGLEVEL_ENUM entries. Do _NOT_ add comma (,) nor - * semicolon (;) after the TRACEPOINT_LOGLEVEL_ENUM declaration. The - * name should be a proper C99 identifier. - * - * TRACEPOINT_LOGLEVEL_ENUM( - * TP_LOGLEVEL( < loglevel_name >, < value > ) - * TP_LOGLEVEL( < loglevel_name >, < value > ) - * ... - * ) - * - * e.g.: - * - * TRACEPOINT_LOGLEVEL_ENUM( - * TP_LOGLEVEL(LOG_EMERG, 0) - * TP_LOGLEVEL(LOG_ALERT, 1) - * TP_LOGLEVEL(LOG_CRIT, 2) - * TP_LOGLEVEL(LOG_ERR, 3) - * TP_LOGLEVEL(LOG_WARNING, 4) - * TP_LOGLEVEL(LOG_NOTICE, 5) - * TP_LOGLEVEL(LOG_INFO, 6) - * TP_LOGLEVEL(LOG_DEBUG, 7) - * ) - * - * 2) Then, declare tracepoint loglevels for tracepoints. A - * TRACEPOINT_EVENT should be declared prior to the the - * TRACEPOINT_LOGLEVEL for a given tracepoint name. The first field - * is the name of the tracepoint, the second field is the loglevel - * name. - * - * TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >, - * < loglevel_name >) - * - * The TRACEPOINT_PROVIDER must be defined when declaring a - * TRACEPOINT_LOGLEVEL_ENUM and TRACEPOINT_LOGLEVEL. The tracepoint - * loglevel enumeration apply to the entire TRACEPOINT_PROVIDER. Only one - * tracepoint loglevel enumeration should be declared per tracepoint - * provider. - */ - -#define TRACEPOINT_LOGLEVEL_ENUM() -#define TRACEPOINT_LOGLEVEL(name, loglevel) - -#endif /* #ifndef TRACEPOINT_LOGLEVEL */ diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 90a0822f..31140b4e 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -8,7 +8,14 @@ * * LTTng-UST ABI header * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #include diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index b930a349..6c272172 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -8,7 +8,14 @@ * * Holds LTTng per-session event registry. * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #include @@ -150,7 +157,7 @@ struct lttng_enum { const char *name; struct lttng_type container_type; const struct lttng_enum_entry *entries; - unsigned int len; + nsigned int len; }; /* Event field description */ diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h deleted file mode 100644 index 43f18657..00000000 --- a/include/lttng/ust-tracepoint-event-reset.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * lttng/ust-tracepoint-events-reset.h - * - * Copyright (C) 2010-2011 Mathieu Desnoyers - * - * Dual LGPL v2.1/GPL v2 license. - */ - -/* Reset macros used within TRACEPOINT_EVENT to "nothing" */ - -#undef ctf_integer_ext -#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) - -#undef ctf_float -#define ctf_float(_type, _item, _src) - -#undef ctf_array_encoded -#define ctf_array_encoded(_type, _item, _src, _length, _encoding) - -#undef ctf_sequence_encoded -#define ctf_sequence_encoded(_type, _item, _src, _length_type, \ - _src_length, _encoding) - -#undef ctf_string -#define ctf_string(_item, _src) - -#undef TP_ARGS -#define TP_ARGS(args...) - -#undef TP_FIELDS -#define TP_FIELDS(args...) - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) - -#undef TRACEPOINT_EVENT_INSTANCE -#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h deleted file mode 100644 index d5ffc8aa..00000000 --- a/include/lttng/ust-tracepoint-event.h +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (C) 2009 Steven Rostedt - * 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 - -/* - * Macro declarations used for all stages. - */ - -#undef ctf_integer -#define ctf_integer(_type, _item, _src) \ - ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10) - -#undef ctf_integer_hex -#define ctf_integer_hex(_type, _item, _src) \ - ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 16) - -#undef ctf_integer_network -#define ctf_integer_network(_type, _item, _src) \ - ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 10) - -#undef ctf_integer_network_hex -#define ctf_integer_network_hex(_type, _item, _src) \ - ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16) - -/* ctf_float is redefined at each step */ - -#undef ctf_array -#define ctf_array(_type, _item, _src, _length) \ - ctf_array_encoded(_type, _item, _src, _length, none) - -#undef ctf_array_text -#define ctf_array_text(_type, _item, _src, _length) \ - ctf_array_encoded(_type, _item, _src, _length, UTF8) - -#undef ctf_sequence -#define ctf_sequence(_type, _item, _src, _length_type, _src_length) \ - ctf_sequence_encoded(_type, _item, _src, \ - _length_type, _src_length, none) - -#undef ctf_sequence_text -#define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \ - ctf_sequence_encoded(_type, _item, _src, \ - _length_type, _src_length, UTF8) - -/* ctf_string is redefined at each step */ - -/* - * TRACEPOINT_EVENT_CLASS can be used to add a generic function handlers - * for events. That is, if all events have the same parameters and just - * have distinct trace points. Each tracepoint can be defined with - * TRACEPOINT_EVENT_INSTANCE and that will map the - * TRACEPOINT_EVENT_CLASS to the tracepoint. - * - * TRACEPOINT_EVENT is a one to one mapping between tracepoint and - * template. - */ - -#undef TRACEPOINT_EVENT -#define TRACEPOINT_EVENT(provider, name, args, fields) \ - TRACEPOINT_EVENT_CLASS(provider, name, \ - TP_PARAMS(args), \ - TP_PARAMS(fields)) \ - TRACEPOINT_EVENT_INSTANCE(provider, name, name, TP_PARAMS(args)) - -/* 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 0 of the trace events. - * - * Check that each TRACEPOINT_EVENT provider argument match the - * TRACEPOINT_PROVIDER by creating dummy callbacks. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#define TP_ID1(_token, _provider) _token##_provider -#define TP_ID(_token, _provider) TP_ID1(_token, _provider) - -static inline -void TP_ID(__tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void) -{ -} - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ - __tracepoint_provider_mismatch_##_provider(); - -#undef TRACEPOINT_EVENT_INSTANCE -#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ - __tracepoint_provider_mismatch_##_provider(); - -static __attribute__((unused)) -void TP_ID(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void) -{ -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) -} - -#undef TP_ID1 -#undef TP_ID - -/* - * Stage 1 of the trace events. - * - * Create event field type metadata section. - * Each event produce an array of fields. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef ctf_integer_ext -#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ - { \ - .name = #_item, \ - .type = __type_integer(_type, _byte_order, _base, none),\ - }, - -#undef ctf_float -#define ctf_float(_type, _item, _src) \ - { \ - .name = #_item, \ - .type = __type_float(_type), \ - }, - -#undef ctf_array_encoded -#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \ - { \ - .name = #_item, \ - .type = \ - { \ - .atype = atype_array, \ - .u.array = \ - { \ - .length = _length, \ - .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \ - }, \ - }, \ - }, - -#undef ctf_sequence_encoded -#define ctf_sequence_encoded(_type, _item, _src, \ - _length_type, _src_length, _encoding) \ - { \ - .name = #_item, \ - .type = \ - { \ - .atype = atype_sequence, \ - .u.sequence = \ - { \ - .length_type = __type_integer(_length_type, BYTE_ORDER, 10, none), \ - .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \ - }, \ - }, \ - }, - -#undef ctf_string -#define ctf_string(_item, _src) \ - { \ - .name = #_item, \ - .type = \ - { \ - .atype = atype_string, \ - .u.basic.string.encoding = lttng_encode_UTF8, \ - }, \ - }, - -#undef TP_FIELDS -#define TP_FIELDS(args...) args /* Only one used in this phase */ - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ - static const struct lttng_event_field __event_fields___##_provider##___##_name[] = { \ - _fields \ - }; - -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) - -/* - * Stage 2 of the trace events. - * - * Create probe callback prototypes. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef TP_ARGS -#define TP_ARGS(args...) args - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static void __event_probe__##_provider##___##_name(_TP_ARGS_PROTO_DATA(_args)); - -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) - -/* - * Stage 3 of the trace events. - * - * Create an array of events. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef TRACEPOINT_EVENT_INSTANCE -#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ - { \ - .fields = __event_fields___##_provider##___##_template,\ - .name = #_provider ":" #_name, \ - .probe_callback = (void *) &__event_probe__##_provider##___##_template,\ - .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template), \ - }, - -#define TP_ID1(_token, _provider) _token##_provider -#define TP_ID(_token, _provider) TP_ID1(_token, _provider) - -static const struct lttng_event_desc TP_ID(__event_desc___, TRACEPOINT_PROVIDER)[] = { -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) -}; - -#undef TP_ID1 -#undef TP_ID - - -/* - * Stage 4 of the trace events. - * - * Create a toplevel descriptor for the whole probe. - */ - -#define TP_ID1(_token, _provider) _token##_provider -#define TP_ID(_token, _provider) TP_ID1(_token, _provider) - -/* non-const because list head will be modified when registered. */ -static struct lttng_probe_desc TP_ID(__probe_desc___, TRACEPOINT_PROVIDER) = { - .event_desc = TP_ID(__event_desc___, TRACEPOINT_PROVIDER), - .nr_events = _TP_ARRAY_SIZE(TP_ID(__event_desc___, TRACEPOINT_PROVIDER)), -}; - -#undef TP_ID1 -#undef TP_ID - -/* - * Stage 5 of the trace events. - * - * Create static inline function that calculates event size. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef ctf_integer_ext -#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ - __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, lttng_alignof(_type)); \ - __event_len += sizeof(_type); - -#undef ctf_array_encoded -#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \ - __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, lttng_alignof(_length_type)); \ - __event_len += sizeof(_length_type); \ - __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ - __dynamic_len[__dynamic_len_idx] = (_src_length); \ - __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ - __dynamic_len_idx++; - -#undef ctf_string -#define ctf_string(_item, _src) \ - __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1; - -#undef TP_ARGS -#define TP_ARGS(args...) args - -#undef TP_FIELDS -#define TP_FIELDS(args...) args - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_PROTO_DATA(_args)) \ -{ \ - size_t __event_len = 0; \ - unsigned int __dynamic_len_idx = 0; \ - \ - if (0) \ - (void) __dynamic_len_idx; /* don't warn if unused */ \ - _fields \ - return __event_len; \ -} - -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) - -/* - * Stage 6 of the trace events. - * - * Create static inline function that calculates event payload alignment. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef ctf_integer_ext -#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ - __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type)); - -#undef ctf_float -#define ctf_float(_type, _item, _src) \ - __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type)); - -#undef ctf_array_encoded -#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \ - __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 = _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) - -#undef TP_ARGS -#define TP_ARGS(args...) args - -#undef TP_FIELDS -#define TP_FIELDS(args...) args - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static inline \ -size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ -{ \ - size_t __event_align = 1; \ - _fields \ - return __event_align; \ -} - -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) - - -/* - * Stage 7 of the trace events. - * - * Create the probe function : call even size calculation and write event data - * into the buffer. - * - * We use both the field and assignment macros to write the fields in the order - * defined in the field declaration. The field declarations control the - * execution order, jumping to the appropriate assignment block. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef ctf_integer_ext -#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \ - { \ - _type __tmp = (_src); \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\ - __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\ - } - -#undef ctf_float -#define ctf_float(_type, _item, _src) \ - { \ - _type __tmp = (_src); \ - 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, _encoding) \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \ - __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); - -#undef ctf_sequence_encoded -#define ctf_sequence_encoded(_type, _item, _src, _length_type, \ - _src_length, _encoding) \ - { \ - _length_type __tmpl = __dynamic_len[__dynamic_len_idx]; \ - 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, lttng_alignof(_type)); \ - __chan->ops->event_write(&__ctx, _src, \ - sizeof(_type) * __get_dynamic_len(dest)); - -#undef ctf_string -#define ctf_string(_item, _src) \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \ - __chan->ops->event_write(&__ctx, _src, __get_dynamic_len(dest)); - -/* Beware: this get len actually consumes the len value */ -#undef __get_dynamic_len -#define __get_dynamic_len(field) __dynamic_len[__dynamic_len_idx++] - -#undef TP_ARGS -#define TP_ARGS(args...) args - -#undef TP_FIELDS -#define TP_FIELDS(args...) args - -#undef TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static void __event_probe__##_provider##___##_name(_TP_ARGS_PROTO_DATA(_args))\ -{ \ - struct ltt_event *__event = __tp_cb_data; \ - struct ltt_channel *__chan = __event->chan; \ - struct lttng_ust_lib_ring_buffer_ctx __ctx; \ - size_t __event_len, __event_align; \ - size_t __dynamic_len_idx = 0; \ - size_t __dynamic_len[_TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \ - int __ret; \ - \ - if (0) \ - (void) __dynamic_len_idx; /* don't warn if unused */ \ - if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \ - return; \ - if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \ - return; \ - if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \ - return; \ - __event_len = __event_get_size__##_provider##___##_name(__dynamic_len,\ - _TP_ARGS_VARS_DATA(_args)); \ - __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VARS(_args)); \ - lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \ - __event_align, -1, __chan->handle); \ - __ret = __chan->ops->event_reserve(&__ctx, __event->id); \ - if (__ret < 0) \ - return; \ - _fields \ - __chan->ops->event_commit(&__ctx); \ -} - -#include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) - -#undef __get_dynamic_len - -/* - * Stage 8 of the trace events. - * - * Register/unregister probes at module load/unload. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#define TP_ID1(_token, _provider) _token##_provider -#define TP_ID(_token, _provider) TP_ID1(_token, _provider) - -static void __attribute__((constructor)) -TP_ID(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) -{ - int ret; - - ret = ltt_probe_register(&TP_ID(__probe_desc___, TRACEPOINT_PROVIDER)); - assert(!ret); -} - -static void __attribute__((destructor)) -TP_ID(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) -{ - ltt_probe_unregister(&TP_ID(__probe_desc___, TRACEPOINT_PROVIDER)); -} - -#undef TP_ID1 -#undef TP_ID diff --git a/include/lttng/vatomic.h b/include/lttng/vatomic.h index a477d4c9..29bb67d7 100644 --- a/include/lttng/vatomic.h +++ b/include/lttng/vatomic.h @@ -6,7 +6,14 @@ * * Copyright (C) 2010 - Mathieu Desnoyers * - * Dual LGPL v2.1/GPL v2 license. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #include diff --git a/lgpl-relicensing.txt b/lgpl-relicensing.txt deleted file mode 100644 index 5cec5dc5..00000000 --- a/lgpl-relicensing.txt +++ /dev/null @@ -1,23 +0,0 @@ -Nils Carlson -Aug 30th, 2010 -Mathieu Desnoyers -April 13th, 2011 - -The following copyright holders have agreed to LGPLv2.1 (not later) -re-licensing of their contributions to linux/include/tracepoint.h, -linux/trace/define_trace.h as concerns the TRACE_EVENT macro. - -Mathieu Desnoyers -Steven Rostedt - https://lkml.org/lkml/2011/4/13/484 -Frederic Weisbecker -Xiao Guangrong -Josh Stone -Lai Jiangshan - -The following copyright holders have agreed to LGPLv2.1 (not later) -re-licensing of their contributions to linux/include/stringify.h. - -Zhaolei - -The full license text may be found in lgpl-2.1.txt. -- 2.34.1