From 4bd69c5f1161cd065f487da0f4c1aa03a73c47e4 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 6 Oct 2021 12:15:33 -0400 Subject: [PATCH] lib: compile liblttng-ctl as C++ MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Same as the previous commits, but compile the liblttng-ctl library as C++ code (while still offering a C interface). Some exported global variables (for example in deprecated-symbols.cpp) have to be made non-const, otherwise we get: CXX deprecated-symbols.lo /home/simark/src/lttng-tools/src/lib/lttng-ctl/deprecated-symbols.cpp:21:33: error: ‘visibility’ attribute ignored [-Werror=attributes] 21 | LTTNG_EXPORT const char * const config_element_pid_tracker; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ I think this is related to the fact that const global variables automatically have internal linkage in C++. Despite using -export-symbols in src/lib/lttng-ctl/Makefile.am, some new ELF symbols become exposed. It could be related to this, in the ld man page: --retain-symbols-file does not discard undefined symbols, or symbols needed for relocations. One new symbol I see, for example, is `_Z16connect_sessiondv`. Looking at liblttng-ctl.so, I indeed see a relocation for this symbol: 000000000010b778 0000053e00000007 R_X86_64_JUMP_SLOT 00000000000314a2 _Z16connect_sessiondv + 0 And that would explain why the linker keeps that symbol visible. This is related to the entry for this function in the procedure linkage table. I'm not entirely sure why these functions didn't generate a PLT entry in C, but do in C++. To avoid these new symbols, build everything with -fvisibility=hidden and -fvisibility-inlines-hidden, and tag functions we really want to export with LTTNG_EXPORT, a new macro defined to __attribute__((visibility("default"))). This macro is publicly visible, because it has to be used in distributed header files (although it's of no use for users of liblttng-ctl). Change-Id: Ie51bf0a2edfb87e5f46f9c39eed5309d9f8c41d6 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- configure.ac | 4 +- include/Makefile.am | 1 + include/lttng/action/action.h | 6 +- include/lttng/action/list.h | 10 +- include/lttng/action/notify.h | 8 +- include/lttng/action/path.h | 9 +- include/lttng/action/rate-policy.h | 13 +- include/lttng/action/rotate-session.h | 12 +- include/lttng/action/snapshot-session.h | 16 +- include/lttng/action/start-session.h | 12 +- include/lttng/action/stop-session.h | 12 +- include/lttng/channel.h | 25 +- include/lttng/clear-handle.h | 7 +- include/lttng/clear.h | 3 +- include/lttng/condition/buffer-usage.h | 29 +-- include/lttng/condition/condition.h | 6 +- include/lttng/condition/evaluation.h | 5 +- include/lttng/condition/event-rule-matches.h | 13 +- .../lttng/condition/session-consumed-size.h | 13 +- include/lttng/condition/session-rotation.h | 13 +- include/lttng/destruction-handle.h | 11 +- include/lttng/domain.h | 3 +- include/lttng/endpoint.h | 6 +- include/lttng/error-query.h | 25 +- include/lttng/event-expr.h | 27 +-- include/lttng/event-field-value.h | 15 +- include/lttng/event-rule/event-rule.h | 6 +- include/lttng/event-rule/jul-logging.h | 15 +- include/lttng/event-rule/kernel-kprobe.h | 9 +- include/lttng/event-rule/kernel-syscall.h | 13 +- include/lttng/event-rule/kernel-tracepoint.h | 11 +- include/lttng/event-rule/kernel-uprobe.h | 9 +- include/lttng/event-rule/log4j-logging.h | 15 +- include/lttng/event-rule/python-logging.h | 15 +- include/lttng/event-rule/user-tracepoint.h | 21 +- include/lttng/event.h | 41 ++-- include/lttng/handle.h | 5 +- include/lttng/health.h | 22 +- include/lttng/kernel-probe.h | 15 +- include/lttng/load.h | 36 +-- include/lttng/location.h | 15 +- include/lttng/log-level-rule.h | 14 +- include/lttng/lttng-error.h | 4 +- include/lttng/lttng-export.h | 14 ++ include/lttng/lttng.h | 25 +- include/lttng/notification/channel.h | 13 +- include/lttng/notification/notification.h | 10 +- include/lttng/rotation.h | 37 +-- include/lttng/save.h | 28 +-- include/lttng/session-descriptor.h | 22 +- include/lttng/session.h | 21 +- include/lttng/snapshot.h | 43 ++-- include/lttng/tracker.h | 71 +++--- include/lttng/trigger/trigger.h | 35 +-- include/lttng/userspace-probe.h | 38 ++-- src/bin/lttng-consumerd/lttng-consumerd.h | 8 +- .../lttng-sessiond/notification-thread.cpp | 7 +- src/bin/lttng-sessiond/ust-sigbus.cpp | 3 +- src/common/config/config-session-abi.h | 174 +++++++------- src/common/config/session-config.c | 24 +- src/common/consumer/consumer.h | 8 +- src/common/error.h | 2 +- src/common/filter/filter-lexer.l | 213 ++++++++++++++++++ src/common/filter/filter-symbols.h | 58 ++--- src/common/hashtable/hashtable.h | 3 +- src/common/index-allocator.h | 11 +- src/common/lttng-elf.h | 6 +- src/common/mi-lttng.c | 16 +- src/common/mi-lttng.h | 200 ++++++++-------- src/common/sessiond-comm/inet.h | 2 +- src/common/spawn-viewer.h | 3 +- src/common/ust-consumer/ust-consumer.c | 2 +- src/lib/lttng-ctl/Makefile.am | 18 +- src/lib/lttng-ctl/{channel.c => channel.cpp} | 8 +- src/lib/lttng-ctl/{clear.c => clear.cpp} | 7 +- src/lib/lttng-ctl/deprecated-symbols.c | 23 -- src/lib/lttng-ctl/deprecated-symbols.cpp | 24 ++ ...uction-handle.c => destruction-handle.cpp} | 7 +- src/lib/lttng-ctl/{event.c => event.cpp} | 4 +- src/lib/lttng-ctl/{load.c => load.cpp} | 14 +- ...ttng-ctl-health.c => lttng-ctl-health.cpp} | 120 +++++++--- .../lttng-ctl/{lttng-ctl.c => lttng-ctl.cpp} | 51 +++-- src/lib/lttng-ctl/{rotate.c => rotate.cpp} | 10 +- src/lib/lttng-ctl/{save.c => save.cpp} | 2 +- .../lttng-ctl/{snapshot.c => snapshot.cpp} | 4 +- src/lib/lttng-ctl/{tracker.c => tracker.cpp} | 8 +- tests/regression/tools/health/health_fail.c | 39 ++-- tests/regression/tools/health/health_stall.c | 39 ++-- tests/regression/tools/live/live_test.c | 3 +- .../tools/notification/consumer_testpoints.c | 5 +- .../tools/notification/sessiond_testpoints.c | 5 +- .../lttng-ust-clock-override-test.c | 3 +- .../lttng-ust-getcpu-override-test.c | 3 +- tests/regression/ust/multi-lib/callsites.h | 6 +- tests/regression/ust/ust-dl/libbar.h | 4 +- tests/regression/ust/ust-dl/libfoo.h | 4 +- tests/unit/test_kernel_data.cpp | 3 +- tests/unit/test_ust_data.cpp | 2 +- tests/unit/ust-sigbus.c | 3 +- .../testapp/userspace-probe-elf-binary/foo.h | 4 +- 100 files changed, 1248 insertions(+), 842 deletions(-) create mode 100644 include/lttng/lttng-export.h rename src/lib/lttng-ctl/{channel.c => channel.cpp} (98%) rename src/lib/lttng-ctl/{clear.c => clear.cpp} (97%) delete mode 100644 src/lib/lttng-ctl/deprecated-symbols.c create mode 100644 src/lib/lttng-ctl/deprecated-symbols.cpp rename src/lib/lttng-ctl/{destruction-handle.c => destruction-handle.cpp} (98%) rename src/lib/lttng-ctl/{event.c => event.cpp} (97%) rename src/lib/lttng-ctl/{load.c => load.cpp} (96%) rename src/lib/lttng-ctl/{lttng-ctl-health.c => lttng-ctl-health.cpp} (69%) rename src/lib/lttng-ctl/{lttng-ctl.c => lttng-ctl.cpp} (98%) rename src/lib/lttng-ctl/{rotate.c => rotate.cpp} (97%) rename src/lib/lttng-ctl/{save.c => save.cpp} (97%) rename src/lib/lttng-ctl/{snapshot.c => snapshot.cpp} (98%) rename src/lib/lttng-ctl/{tracker.c => tracker.cpp} (99%) diff --git a/configure.ac b/configure.ac index e6b0d8e5a..abb61d27f 100644 --- a/configure.ac +++ b/configure.ac @@ -1085,10 +1085,10 @@ AM_CONDITIONAL([BUILD_LIB_SESSIOND_COMM], [test x$build_lib_sessiond_comm = xyes AM_CONDITIONAL([BUILD_LIB_TESTPOINT], [test x$build_lib_testpoint = xyes]) AM_CONDITIONAL([BUILD_LIB_UST_CONSUMER], [test x$build_lib_ust_consumer = xyes]) -AM_CFLAGS="$OPT_CFLAGS $WARN_CFLAGS $PTHREAD_CFLAGS" +AM_CFLAGS="-fvisibility=hidden $OPT_CFLAGS $WARN_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) -AM_CXXFLAGS="$OPT_CXXFLAGS $WARN_CXXFLAGS $PTHREAD_CFLAGS" +AM_CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden $OPT_CXXFLAGS $WARN_CXXFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CXXFLAGS) # This is set even though it is empty, so Makefiles can do "AM_LDFLAGS += ...". diff --git a/include/Makefile.am b/include/Makefile.am index 12c5f883c..6fe724b3a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -115,6 +115,7 @@ lttnginclude_HEADERS = \ lttng/location.h \ lttng/log-level-rule.h \ lttng/lttng-error.h \ + lttng/lttng-export.h \ lttng/lttng.h \ lttng/rotation.h \ lttng/save.h \ diff --git a/include/lttng/action/action.h b/include/lttng/action/action.h index cd3857d72..70237e43c 100644 --- a/include/lttng/action/action.h +++ b/include/lttng/action/action.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_H #define LTTNG_ACTION_H +#include + struct lttng_action; #ifdef __cplusplus @@ -37,13 +39,13 @@ enum lttng_action_status { * * Returns the type of an action on success, LTTNG_ACTION_TYPE_UNKNOWN on error. */ -extern enum lttng_action_type lttng_action_get_type( +LTTNG_EXPORT extern enum lttng_action_type lttng_action_get_type( const struct lttng_action *action); /* * Destroy (frees) an action object. */ -extern void lttng_action_destroy(struct lttng_action *action); +LTTNG_EXPORT extern void lttng_action_destroy(struct lttng_action *action); #ifdef __cplusplus } diff --git a/include/lttng/action/list.h b/include/lttng/action/list.h index ca871744d..9c23d60ca 100644 --- a/include/lttng/action/list.h +++ b/include/lttng/action/list.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_LIST_H #define LTTNG_ACTION_LIST_H +#include + struct lttng_action; #ifdef __cplusplus @@ -20,7 +22,7 @@ extern "C" { * Returns a new action list on success, NULL on failure. This action list * must be destroyed using lttng_action_list_destroy(). */ -extern struct lttng_action *lttng_action_list_create(void); +LTTNG_EXPORT extern struct lttng_action *lttng_action_list_create(void); /* * Add an action to an lttng_action object of type LTTNG_ACTION_LIST. @@ -31,13 +33,13 @@ extern struct lttng_action *lttng_action_list_create(void); * * Adding an action list to an action list is not supported. */ -extern enum lttng_action_status lttng_action_list_add_action( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_add_action( struct lttng_action *list, struct lttng_action *action); /* * Get the number of actions in an action list. */ -extern enum lttng_action_status lttng_action_list_get_count( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_get_count( const struct lttng_action *list, unsigned int *count); /* @@ -49,7 +51,7 @@ extern enum lttng_action_status lttng_action_list_get_count( * * Returns an action, or NULL on error. */ -extern const struct lttng_action *lttng_action_list_get_at_index( +LTTNG_EXPORT extern const struct lttng_action *lttng_action_list_get_at_index( const struct lttng_action *list, unsigned int index); diff --git a/include/lttng/action/notify.h b/include/lttng/action/notify.h index 08574753f..3aa55e09c 100644 --- a/include/lttng/action/notify.h +++ b/include/lttng/action/notify.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_NOTIFY_H #define LTTNG_ACTION_NOTIFY_H +#include + struct lttng_action; struct lttng_rate_policy; @@ -28,7 +30,7 @@ extern "C" { * Returns a new action on success, NULL on failure. This action must be * destroyed using lttng_action_destroy(). */ -extern struct lttng_action *lttng_action_notify_create(void); +LTTNG_EXPORT extern struct lttng_action *lttng_action_notify_create(void); /* * Set the rate policy of a notify action. @@ -37,7 +39,7 @@ extern struct lttng_action *lttng_action_notify_create(void); * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_notify_set_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_set_rate_policy( struct lttng_action *action, const struct lttng_rate_policy *policy); @@ -47,7 +49,7 @@ extern enum lttng_action_status lttng_action_notify_set_rate_policy( * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_notify_get_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_get_rate_policy( const struct lttng_action *action, const struct lttng_rate_policy **policy); diff --git a/include/lttng/action/path.h b/include/lttng/action/path.h index 507b4ab49..6ec91676b 100644 --- a/include/lttng/action/path.h +++ b/include/lttng/action/path.h @@ -8,6 +8,7 @@ #ifndef LTTNG_ACTION_PATH_H #define LTTNG_ACTION_PATH_H +#include #include #include @@ -44,19 +45,19 @@ enum lttng_action_path_status { * * The `indexes` are copied internally and can be disposed-of by the caller. */ -extern struct lttng_action_path *lttng_action_path_create( +LTTNG_EXPORT extern struct lttng_action_path *lttng_action_path_create( const uint64_t *indexes, size_t index_count); /* * Get the count of indexes in an action path. */ -extern enum lttng_action_path_status lttng_action_path_get_index_count( +LTTNG_EXPORT extern enum lttng_action_path_status lttng_action_path_get_index_count( const struct lttng_action_path *path, size_t *index_count); /* * Get an index from an action path. */ -extern enum lttng_action_path_status lttng_action_path_get_index_at_index( +LTTNG_EXPORT extern enum lttng_action_path_status lttng_action_path_get_index_at_index( const struct lttng_action_path *path, size_t path_index, uint64_t *out_index); @@ -64,7 +65,7 @@ extern enum lttng_action_path_status lttng_action_path_get_index_at_index( /* * Destroy an action path object. */ -extern void lttng_action_path_destroy(struct lttng_action_path *action_path); +LTTNG_EXPORT extern void lttng_action_path_destroy(struct lttng_action_path *action_path); #ifdef __cplusplus } diff --git a/include/lttng/action/rate-policy.h b/include/lttng/action/rate-policy.h index a3a288a28..1cd0126e3 100644 --- a/include/lttng/action/rate-policy.h +++ b/include/lttng/action/rate-policy.h @@ -9,6 +9,7 @@ #define LTTNG_RATE_POLICY_H #include +#include #include struct lttng_rate_policy; @@ -36,7 +37,7 @@ enum lttng_rate_policy_type { /* * Get the type of a rate policy. */ -extern enum lttng_rate_policy_type lttng_rate_policy_get_type( +LTTNG_EXPORT extern enum lttng_rate_policy_type lttng_rate_policy_get_type( const struct lttng_rate_policy *policy); /* @@ -49,7 +50,7 @@ extern enum lttng_rate_policy_type lttng_rate_policy_get_type( * rate_policy objects must be destroyed using the lttng_rate_policy_destroy() * function. */ -extern struct lttng_rate_policy *lttng_rate_policy_every_n_create( +LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_every_n_create( uint64_t interval); /* @@ -59,7 +60,7 @@ extern struct lttng_rate_policy *lttng_rate_policy_every_n_create( * on success, LTTNG_RATE_FIRING_POLICY_STATUS_INVALID if an invalid * parameter is passed. */ -extern enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval( +LTTNG_EXPORT extern enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval( const struct lttng_rate_policy *policy, uint64_t *interval); /* @@ -73,7 +74,7 @@ extern enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval( * rate_policy objects must be destroyed using the lttng_rate_policy_destroy() * function. */ -extern struct lttng_rate_policy *lttng_rate_policy_once_after_n_create( +LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_once_after_n_create( uint64_t threshold); /* @@ -83,14 +84,14 @@ extern struct lttng_rate_policy *lttng_rate_policy_once_after_n_create( * on success, LTTNG_RATE_POLICY_STATUS_INVALID if an invalid * parameter is passed. */ -extern enum lttng_rate_policy_status +LTTNG_EXPORT extern enum lttng_rate_policy_status lttng_rate_policy_once_after_n_get_threshold( const struct lttng_rate_policy *policy, uint64_t *threshold); /* * Destroy (frees) a rate policy object. */ -extern void lttng_rate_policy_destroy(struct lttng_rate_policy *policy); +LTTNG_EXPORT extern void lttng_rate_policy_destroy(struct lttng_rate_policy *policy); #ifdef __cplusplus } diff --git a/include/lttng/action/rotate-session.h b/include/lttng/action/rotate-session.h index 7fbcce98c..199b6f169 100644 --- a/include/lttng/action/rotate-session.h +++ b/include/lttng/action/rotate-session.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_ROTATE_SESSION_H #define LTTNG_ACTION_ROTATE_SESSION_H +#include + struct lttng_action; struct lttng_rate_policy; @@ -25,20 +27,20 @@ extern "C" { * Returns a new action on success, NULL on failure. This action must be * destroyed using lttng_action_destroy(). */ -extern struct lttng_action *lttng_action_rotate_session_create(void); +LTTNG_EXPORT extern struct lttng_action *lttng_action_rotate_session_create(void); /* * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_ROTATE_SESSION. */ -extern enum lttng_action_status lttng_action_rotate_session_set_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_session_name( struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_ROTATE_SESSION. */ -extern enum lttng_action_status lttng_action_rotate_session_get_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_get_session_name( const struct lttng_action *action, const char **session_name); /* @@ -48,7 +50,7 @@ extern enum lttng_action_status lttng_action_rotate_session_get_session_name( * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_rotate_session_set_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_rate_policy( struct lttng_action *action, const struct lttng_rate_policy *policy); @@ -58,7 +60,7 @@ extern enum lttng_action_status lttng_action_rotate_session_set_rate_policy( * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_rotate_session_get_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_get_rate_policy( const struct lttng_action *action, const struct lttng_rate_policy **policy); diff --git a/include/lttng/action/snapshot-session.h b/include/lttng/action/snapshot-session.h index faa9b9fab..859086200 100644 --- a/include/lttng/action/snapshot-session.h +++ b/include/lttng/action/snapshot-session.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_SNAPSHOT_SESSION_H #define LTTNG_ACTION_SNAPSHOT_SESSION_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -26,20 +28,20 @@ struct lttng_rate_policy; * Returns a new action on success, NULL on failure. This action must be * destroyed using lttng_action_destroy(). */ -extern struct lttng_action *lttng_action_snapshot_session_create(void); +LTTNG_EXPORT extern struct lttng_action *lttng_action_snapshot_session_create(void); /* * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_SNAPSHOT_SESSION. */ -extern enum lttng_action_status lttng_action_snapshot_session_set_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_session_name( struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_SNAPSHOT_SESSION. */ -extern enum lttng_action_status lttng_action_snapshot_session_get_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_session_name( const struct lttng_action *action, const char **session_name); /* @@ -50,14 +52,14 @@ extern enum lttng_action_status lttng_action_snapshot_session_get_session_name( * * This function takes ownership of the given snapshot output. */ -extern enum lttng_action_status lttng_action_snapshot_session_set_output( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_output( struct lttng_action *action, struct lttng_snapshot_output *output); /* * Get the explicit snapshot output for this snapshot session action. */ -extern enum lttng_action_status lttng_action_snapshot_session_get_output( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_output( const struct lttng_action *action, const struct lttng_snapshot_output **output); @@ -68,7 +70,7 @@ extern enum lttng_action_status lttng_action_snapshot_session_get_output( * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_snapshot_session_set_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_rate_policy( struct lttng_action *action, const struct lttng_rate_policy *policy); @@ -78,7 +80,7 @@ extern enum lttng_action_status lttng_action_snapshot_session_set_rate_policy( * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_snapshot_session_get_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_rate_policy( const struct lttng_action *action, const struct lttng_rate_policy **policy); diff --git a/include/lttng/action/start-session.h b/include/lttng/action/start-session.h index c63a7d278..db5200032 100644 --- a/include/lttng/action/start-session.h +++ b/include/lttng/action/start-session.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_START_SESSION_H #define LTTNG_ACTION_START_SESSION_H +#include + struct lttng_action; struct lttng_rate_policy; @@ -25,20 +27,20 @@ extern "C" { * Returns a new action on success, NULL on failure. This action must be * destroyed using lttng_action_destroy(). */ -extern struct lttng_action *lttng_action_start_session_create(void); +LTTNG_EXPORT extern struct lttng_action *lttng_action_start_session_create(void); /* * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_START_SESSION. */ -extern enum lttng_action_status lttng_action_start_session_set_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_session_name( struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_START_SESSION. */ -extern enum lttng_action_status lttng_action_start_session_get_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_get_session_name( const struct lttng_action *action, const char **session_name); /* @@ -48,7 +50,7 @@ extern enum lttng_action_status lttng_action_start_session_get_session_name( * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_start_session_set_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_rate_policy( struct lttng_action *action, const struct lttng_rate_policy *policy); @@ -58,7 +60,7 @@ extern enum lttng_action_status lttng_action_start_session_set_rate_policy( * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_start_session_get_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_get_rate_policy( const struct lttng_action *action, const struct lttng_rate_policy **policy); diff --git a/include/lttng/action/stop-session.h b/include/lttng/action/stop-session.h index dbe6819e6..5b223ef23 100644 --- a/include/lttng/action/stop-session.h +++ b/include/lttng/action/stop-session.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ACTION_STOP_SESSION_H #define LTTNG_ACTION_STOP_SESSION_H +#include + struct lttng_action; struct lttng_rate_policy; @@ -25,20 +27,20 @@ extern "C" { * Returns a new action on success, NULL on failure. This action must be * destroyed using lttng_action_destroy(). */ -extern struct lttng_action *lttng_action_stop_session_create(void); +LTTNG_EXPORT extern struct lttng_action *lttng_action_stop_session_create(void); /* * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_STOP_SESSION. */ -extern enum lttng_action_status lttng_action_stop_session_set_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_session_name( struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_STOP_SESSION. */ -extern enum lttng_action_status lttng_action_stop_session_get_session_name( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_get_session_name( const struct lttng_action *action, const char **session_name); /* @@ -48,7 +50,7 @@ extern enum lttng_action_status lttng_action_stop_session_get_session_name( * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_stop_session_set_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_rate_policy( struct lttng_action *action, const struct lttng_rate_policy *policy); @@ -58,7 +60,7 @@ extern enum lttng_action_status lttng_action_stop_session_set_rate_policy( * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_action_status lttng_action_stop_session_get_rate_policy( +LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_get_rate_policy( const struct lttng_action *action, const struct lttng_rate_policy **policy); diff --git a/include/lttng/channel.h b/include/lttng/channel.h index f3241ed30..62e202d26 100644 --- a/include/lttng/channel.h +++ b/include/lttng/channel.h @@ -10,6 +10,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -60,11 +61,11 @@ struct lttng_channel { /* */ -extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain); +LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain); /* */ -extern void lttng_channel_destroy(struct lttng_channel *channel); +LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel); /* * List the channel(s) of a session. @@ -74,7 +75,7 @@ extern void lttng_channel_destroy(struct lttng_channel *channel); * Return the size (number of entries) of the "lttng_channel" array. Caller * must free channels. On error, a negative LTTng error code is returned. */ -extern int lttng_list_channels(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle, struct lttng_channel **channels); /* @@ -84,7 +85,7 @@ extern int lttng_list_channels(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_enable_channel(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *chan); /* @@ -94,7 +95,7 @@ extern int lttng_enable_channel(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_disable_channel(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, const char *name); /* @@ -103,7 +104,7 @@ extern int lttng_disable_channel(struct lttng_handle *handle, * * If one or both arguments are NULL, nothing happens. */ -extern void lttng_channel_set_default_attr(struct lttng_domain *domain, +LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr); /* @@ -111,7 +112,7 @@ extern void lttng_channel_set_default_attr(struct lttng_domain *domain, * * Returns 0 on success, or a negative LTTng error code on error. */ -extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan, +LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan, uint64_t *discarded_events); /* @@ -119,19 +120,19 @@ extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan, * * Returns 0 on success, or a negative LTTng error code on error. */ -extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan, +LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan, uint64_t *lost_packets); -extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan, +LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan, uint64_t *monitor_timer_interval); -extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan, +LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan, uint64_t monitor_timer_interval); -extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan, +LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan, int64_t *blocking_timeout); -extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan, +LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan, int64_t blocking_timeout); #ifdef __cplusplus diff --git a/include/lttng/clear-handle.h b/include/lttng/clear-handle.h index 4d952ce3d..e07e6c47f 100644 --- a/include/lttng/clear-handle.h +++ b/include/lttng/clear-handle.h @@ -10,6 +10,7 @@ #define LTTNG_CLEAR_HANDLE_H #include +#include #ifdef __cplusplus extern "C" { @@ -36,7 +37,7 @@ enum lttng_clear_handle_status { * Destroy an lttng_clear_handle. * The handle should be discarded after this call. */ -extern void lttng_clear_handle_destroy(struct lttng_clear_handle *handle); +LTTNG_EXPORT extern void lttng_clear_handle_destroy(struct lttng_clear_handle *handle); /* * Wait for a session clear operation to complete. @@ -52,7 +53,7 @@ extern void lttng_clear_handle_destroy(struct lttng_clear_handle *handle); * the clear operation itself succeeded; it indicates that the _wait_ * operation completed successfully. */ -extern enum lttng_clear_handle_status +LTTNG_EXPORT extern enum lttng_clear_handle_status lttng_clear_handle_wait_for_completion( struct lttng_clear_handle *handle, int timeout_ms); @@ -71,7 +72,7 @@ extern enum lttng_clear_handle_status * was not waited-on using the handle or if the arguments of the function are * invalid (e.g. NULL). */ -extern enum lttng_clear_handle_status +LTTNG_EXPORT extern enum lttng_clear_handle_status lttng_clear_handle_get_result( const struct lttng_clear_handle *handle, enum lttng_error_code *result); diff --git a/include/lttng/clear.h b/include/lttng/clear.h index b656db9f4..5dfd5db58 100644 --- a/include/lttng/clear.h +++ b/include/lttng/clear.h @@ -10,6 +10,7 @@ #define LTTNG_CLEAR_H #include +#include #ifdef __cplusplus extern "C" { @@ -54,7 +55,7 @@ struct lttng_clear_handle; * LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY * LTTNG_ERR_CLEAR_FAIL_CONSUMER */ -extern enum lttng_error_code lttng_clear_session(const char *session_name, +LTTNG_EXPORT extern enum lttng_error_code lttng_clear_session(const char *session_name, struct lttng_clear_handle **handle); #ifdef __cplusplus } diff --git a/include/lttng/condition/buffer-usage.h b/include/lttng/condition/buffer-usage.h index 0bcf4c7a6..dcdb7ca1f 100644 --- a/include/lttng/condition/buffer-usage.h +++ b/include/lttng/condition/buffer-usage.h @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -56,7 +57,7 @@ extern "C" { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition * +LTTNG_EXPORT extern struct lttng_condition * lttng_condition_buffer_usage_low_create(void); /* @@ -72,7 +73,7 @@ lttng_condition_buffer_usage_low_create(void); * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition * +LTTNG_EXPORT extern struct lttng_condition * lttng_condition_buffer_usage_high_create(void); /* @@ -87,7 +88,7 @@ lttng_condition_buffer_usage_high_create(void); * expressed as a ratio of total buffer capacity, was not set prior to this * call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_get_threshold_ratio( const struct lttng_condition *condition, double *threshold_ratio); @@ -103,7 +104,7 @@ lttng_condition_buffer_usage_get_threshold_ratio( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid paramenters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_set_threshold_ratio( struct lttng_condition *condition, double threshold_ratio); @@ -119,7 +120,7 @@ lttng_condition_buffer_usage_set_threshold_ratio( * LTTNG_CONDITION_STATUS_UNSET if a threshold, expressed as an absolute size in * bytes, was not set prior to this call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_get_threshold( const struct lttng_condition *condition, uint64_t *threshold_bytes); @@ -133,7 +134,7 @@ lttng_condition_buffer_usage_get_threshold( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid paramenters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_set_threshold( struct lttng_condition *condition, uint64_t threshold_bytes); @@ -150,7 +151,7 @@ lttng_condition_buffer_usage_set_threshold( * parameter is passed, or LTTNG_CONDITION_STATUS_UNSET if a session name * was not set prior to this call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_get_session_name( const struct lttng_condition *condition, const char **session_name); @@ -163,7 +164,7 @@ lttng_condition_buffer_usage_get_session_name( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid paramenters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_set_session_name( struct lttng_condition *condition, const char *session_name); @@ -180,7 +181,7 @@ lttng_condition_buffer_usage_set_session_name( * parameter is passed, or LTTNG_CONDITION_STATUS_UNSET if a channel name * was not set prior to this call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_get_channel_name( const struct lttng_condition *condition, const char **channel_name); @@ -193,7 +194,7 @@ lttng_condition_buffer_usage_get_channel_name( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid paramenters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_set_channel_name( struct lttng_condition *condition, const char *channel_name); @@ -206,7 +207,7 @@ lttng_condition_buffer_usage_set_channel_name( * or LTTNG_CONDITION_STATUS_UNSET if a domain type was not set prior to this * call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_get_domain_type( const struct lttng_condition *condition, enum lttng_domain_type *type); @@ -217,7 +218,7 @@ lttng_condition_buffer_usage_get_domain_type( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid paramenters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_buffer_usage_set_domain_type( struct lttng_condition *condition, enum lttng_domain_type type); @@ -240,7 +241,7 @@ lttng_condition_buffer_usage_set_domain_type( * as a ratio of the buffer's capacity, or LTTNG_EVALUATION_STATUS_INVALID if * an invalid parameter is passed. */ -extern enum lttng_evaluation_status +LTTNG_EXPORT extern enum lttng_evaluation_status lttng_evaluation_buffer_usage_get_usage_ratio( const struct lttng_evaluation *evaluation, double *usage_ratio); @@ -251,7 +252,7 @@ lttng_evaluation_buffer_usage_get_usage_ratio( * Returns LTTNG_EVALUATION_STATUS_OK on success and a threshold expressed in * bytes, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is passed. */ -extern enum lttng_evaluation_status +LTTNG_EXPORT extern enum lttng_evaluation_status lttng_evaluation_buffer_usage_get_usage( const struct lttng_evaluation *evaluation, uint64_t *usage_bytes); diff --git a/include/lttng/condition/condition.h b/include/lttng/condition/condition.h index 7aff1469b..f0f5ffdd8 100644 --- a/include/lttng/condition/condition.h +++ b/include/lttng/condition/condition.h @@ -8,6 +8,8 @@ #ifndef LTTNG_CONDITION_H #define LTTNG_CONDITION_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -39,13 +41,13 @@ enum lttng_condition_status { * Returns the type of a condition on success, LTTNG_CONDITION_TYPE_UNKNOWN on * error. */ -extern enum lttng_condition_type lttng_condition_get_type( +LTTNG_EXPORT extern enum lttng_condition_type lttng_condition_get_type( const struct lttng_condition *condition); /* * Destroy (release) a condition object. */ -extern void lttng_condition_destroy(struct lttng_condition *condition); +LTTNG_EXPORT extern void lttng_condition_destroy(struct lttng_condition *condition); #ifdef __cplusplus } diff --git a/include/lttng/condition/evaluation.h b/include/lttng/condition/evaluation.h index 4ae1c62d9..494cb9739 100644 --- a/include/lttng/condition/evaluation.h +++ b/include/lttng/condition/evaluation.h @@ -9,6 +9,7 @@ #define LTTNG_EVALUATION_H #include +#include #ifdef __cplusplus extern "C" { @@ -30,13 +31,13 @@ enum lttng_evaluation_status { * Returns the type of a condition on success, LTTNG_CONDITION_TYPE_UNKNOWN on * error. */ -extern enum lttng_condition_type lttng_evaluation_get_type( +LTTNG_EXPORT extern enum lttng_condition_type lttng_evaluation_get_type( const struct lttng_evaluation *evaluation); /* * Destroy (frees) an evaluation object. */ -extern void lttng_evaluation_destroy(struct lttng_evaluation *evaluation); +LTTNG_EXPORT extern void lttng_evaluation_destroy(struct lttng_evaluation *evaluation); #ifdef __cplusplus } diff --git a/include/lttng/condition/event-rule-matches.h b/include/lttng/condition/event-rule-matches.h index 75d1c88af..b1bbe08f3 100644 --- a/include/lttng/condition/event-rule-matches.h +++ b/include/lttng/condition/event-rule-matches.h @@ -11,6 +11,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -42,7 +43,7 @@ enum lttng_evaluation_event_rule_matches_status { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition *lttng_condition_event_rule_matches_create( +LTTNG_EXPORT extern struct lttng_condition *lttng_condition_event_rule_matches_create( struct lttng_event_rule *rule); /* @@ -55,7 +56,7 @@ extern struct lttng_condition *lttng_condition_event_rule_matches_create( * Returns LTTNG_CONDITION_STATUS_OK and a pointer to the condition's rule * on success, LTTNG_CONDITION_STATUS_INVALID if an invalid * parameter is passed. */ -extern enum lttng_condition_status lttng_condition_event_rule_matches_get_rule( +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_event_rule_matches_get_rule( const struct lttng_condition *condition, const struct lttng_event_rule **rule); @@ -89,7 +90,7 @@ extern enum lttng_condition_status lttng_condition_event_rule_matches_get_rule( * `LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_NONE`: * * The condition of `evaluation` has no capture descriptors. */ -extern enum lttng_evaluation_event_rule_matches_status +LTTNG_EXPORT extern enum lttng_evaluation_event_rule_matches_status lttng_evaluation_event_rule_matches_get_captured_values( const struct lttng_evaluation *evaluation, const struct lttng_event_field_value **field_val); @@ -122,7 +123,7 @@ lttng_evaluation_event_rule_matches_get_captured_values( * `LTTNG_CONDITION_STATUS_UNSUPPORTED`: * * The associated event-rule does not support runtime capture. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_event_rule_matches_append_capture_descriptor( struct lttng_condition *condition, struct lttng_event_expr *expr); @@ -142,7 +143,7 @@ lttng_condition_event_rule_matches_append_capture_descriptor( * `LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES`. * * `count` is `NULL`. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_event_rule_matches_get_capture_descriptor_count( const struct lttng_condition *condition, unsigned int *count); @@ -157,7 +158,7 @@ lttng_condition_event_rule_matches_get_capture_descriptor_count( * descriptors in `condition` (as returned by * lttng_condition_event_rule_matches_get_capture_descriptor_count()). */ -extern const struct lttng_event_expr * +LTTNG_EXPORT extern const struct lttng_event_expr * lttng_condition_event_rule_matches_get_capture_descriptor_at_index( const struct lttng_condition *condition, unsigned int index); diff --git a/include/lttng/condition/session-consumed-size.h b/include/lttng/condition/session-consumed-size.h index 24c9c5455..4d52cb689 100644 --- a/include/lttng/condition/session-consumed-size.h +++ b/include/lttng/condition/session-consumed-size.h @@ -10,6 +10,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -42,7 +43,7 @@ extern "C" { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition * +LTTNG_EXPORT extern struct lttng_condition * lttng_condition_session_consumed_size_create(void); /* @@ -56,7 +57,7 @@ lttng_condition_session_consumed_size_create(void); * LTTNG_CONDITION_STATUS_UNSET if a threshold, expressed as an absolute size in * bytes, was not set prior to this call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_session_consumed_size_get_threshold( const struct lttng_condition *condition, uint64_t *consumed_threshold_bytes); @@ -69,7 +70,7 @@ lttng_condition_session_consumed_size_get_threshold( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_session_consumed_size_set_threshold( struct lttng_condition *condition, uint64_t consumed_threshold_bytes); @@ -86,7 +87,7 @@ lttng_condition_session_consumed_size_set_threshold( * parameter is passed, or LTTNG_CONDITION_STATUS_UNSET if a session name * was not set prior to this call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_session_consumed_size_get_session_name( const struct lttng_condition *condition, const char **session_name); @@ -99,7 +100,7 @@ lttng_condition_session_consumed_size_get_session_name( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_session_consumed_size_set_session_name( struct lttng_condition *condition, const char *session_name); @@ -116,7 +117,7 @@ lttng_condition_session_consumed_size_set_session_name( * Returns LTTNG_EVALUATION_STATUS_OK on success and a threshold expressed in * bytes, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is passed. */ -extern enum lttng_evaluation_status +LTTNG_EXPORT extern enum lttng_evaluation_status lttng_evaluation_session_consumed_size_get_consumed_size( const struct lttng_evaluation *evaluation, uint64_t *session_consumed); diff --git a/include/lttng/condition/session-rotation.h b/include/lttng/condition/session-rotation.h index afd1bbf89..086fff915 100644 --- a/include/lttng/condition/session-rotation.h +++ b/include/lttng/condition/session-rotation.h @@ -13,6 +13,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -38,7 +39,7 @@ extern "C" { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition * +LTTNG_EXPORT extern struct lttng_condition * lttng_condition_session_rotation_ongoing_create(void); /* @@ -53,7 +54,7 @@ lttng_condition_session_rotation_ongoing_create(void); * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition * +LTTNG_EXPORT extern struct lttng_condition * lttng_condition_session_rotation_completed_create(void); /* @@ -68,7 +69,7 @@ lttng_condition_session_rotation_completed_create(void); * parameter is passed, or LTTNG_CONDITION_STATUS_UNSET if a session name * was not set prior to this call. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_session_rotation_get_session_name( const struct lttng_condition *condition, const char **session_name); @@ -81,7 +82,7 @@ lttng_condition_session_rotation_get_session_name( * Returns LTTNG_CONDITION_STATUS_OK on success, LTTNG_CONDITION_STATUS_INVALID * if invalid paramenters are passed. */ -extern enum lttng_condition_status +LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_session_rotation_set_session_name( struct lttng_condition *condition, const char *session_name); @@ -99,7 +100,7 @@ lttng_condition_session_rotation_set_session_name( * rotation, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is * passed. */ -extern enum lttng_evaluation_status +LTTNG_EXPORT extern enum lttng_evaluation_status lttng_evaluation_session_rotation_get_id( const struct lttng_evaluation *evaluation, uint64_t *id); @@ -118,7 +119,7 @@ lttng_evaluation_session_rotation_get_id( * LTTNG_EVALUATION_STATUS_INVALID is returned if an invalid parameter is * passed. */ -extern enum lttng_evaluation_status +LTTNG_EXPORT extern enum lttng_evaluation_status lttng_evaluation_session_rotation_completed_get_location( const struct lttng_evaluation *evaluation, const struct lttng_trace_archive_location **location); diff --git a/include/lttng/destruction-handle.h b/include/lttng/destruction-handle.h index 6757f213a..6fa4339ac 100644 --- a/include/lttng/destruction-handle.h +++ b/include/lttng/destruction-handle.h @@ -10,6 +10,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -43,7 +44,7 @@ enum lttng_destruction_handle_status { * Destroy an lttng_destruction_session handle. * The handle should be discarded after this call. */ -extern void lttng_destruction_handle_destroy( +LTTNG_EXPORT extern void lttng_destruction_handle_destroy( struct lttng_destruction_handle *handle); /* @@ -60,7 +61,7 @@ extern void lttng_destruction_handle_destroy( * the destruction operation itself succeeded; it indicates that the _wait_ * operation completed successfully. */ -extern enum lttng_destruction_handle_status +LTTNG_EXPORT extern enum lttng_destruction_handle_status lttng_destruction_handle_wait_for_completion( struct lttng_destruction_handle *handle, int timeout_ms); @@ -79,7 +80,7 @@ lttng_destruction_handle_wait_for_completion( * was not waited-on using the handle or if the arguments of the function are * invalid (e.g. NULL). */ -extern enum lttng_destruction_handle_status +LTTNG_EXPORT extern enum lttng_destruction_handle_status lttng_destruction_handle_get_result( const struct lttng_destruction_handle *handle, enum lttng_error_code *result); @@ -107,7 +108,7 @@ lttng_destruction_handle_get_result( * Note that if no rotation was performed, rotation_state will be set to * LTTNG_ROTATION_STATE_NO_ROTATION. */ -extern enum lttng_destruction_handle_status +LTTNG_EXPORT extern enum lttng_destruction_handle_status lttng_destruction_handle_get_rotation_state( const struct lttng_destruction_handle *handle, enum lttng_rotation_state *rotation_state); @@ -131,7 +132,7 @@ lttng_destruction_handle_get_rotation_state( * of the session's destruction, or if the arguments of the function are * invalid (e.g. NULL). */ -extern enum lttng_destruction_handle_status +LTTNG_EXPORT extern enum lttng_destruction_handle_status lttng_destruction_handle_get_archive_location( const struct lttng_destruction_handle *handle, const struct lttng_trace_archive_location **location); diff --git a/include/lttng/domain.h b/include/lttng/domain.h index ba62e0ec9..192c04bf2 100644 --- a/include/lttng/domain.h +++ b/include/lttng/domain.h @@ -13,6 +13,7 @@ extern "C" { #endif #include +#include /* * Domain types: the different possible tracers. @@ -58,7 +59,7 @@ struct lttng_domain { * Return the size (number of entries) of the "lttng_domain" array. Caller * must free domains. On error, a negative LTTng error code is returned. */ -extern int lttng_list_domains(const char *session_name, +LTTNG_EXPORT extern int lttng_list_domains(const char *session_name, struct lttng_domain **domains); #ifdef __cplusplus diff --git a/include/lttng/endpoint.h b/include/lttng/endpoint.h index 1db5e5108..e27ac3b01 100644 --- a/include/lttng/endpoint.h +++ b/include/lttng/endpoint.h @@ -8,6 +8,8 @@ #ifndef LTTNG_ENDPOINT_H #define LTTNG_ENDPOINT_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -24,7 +26,7 @@ extern "C" { * - Otherwise (caller is an unpriviliged user): * - Attempt to connect to the session daemon running as the caller's user. */ -extern struct lttng_endpoint *lttng_session_daemon_notification_endpoint; +LTTNG_EXPORT extern struct lttng_endpoint *lttng_session_daemon_notification_endpoint; /* * Default LTTng session daemon command endpoint singleton. @@ -38,7 +40,7 @@ extern struct lttng_endpoint *lttng_session_daemon_notification_endpoint; * - Otherwise (caller is an unpriviliged user): * - Attempt to connect to the session daemon running as the caller's user. */ -extern struct lttng_endpoint *lttng_session_daemon_command_endpoint; +LTTNG_EXPORT extern struct lttng_endpoint *lttng_session_daemon_command_endpoint; #ifdef __cplusplus } diff --git a/include/lttng/error-query.h b/include/lttng/error-query.h index ff0f0ae99..a7cbae421 100644 --- a/include/lttng/error-query.h +++ b/include/lttng/error-query.h @@ -11,6 +11,7 @@ #define LTTNG_ERROR_QUERY_H #include +#include #include #include @@ -58,11 +59,11 @@ enum lttng_error_query_results_status { }; /* Create an error query targetting a trigger object. */ -extern struct lttng_error_query *lttng_error_query_trigger_create( +LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_trigger_create( const struct lttng_trigger *trigger); /* Create an error query targetting a trigger's condition object. */ -extern struct lttng_error_query *lttng_error_query_condition_create( +LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_condition_create( const struct lttng_trigger *trigger); /* @@ -71,12 +72,12 @@ extern struct lttng_error_query *lttng_error_query_condition_create( * `action_path` is copied internally. The root of the `action_path` is the * action of `trigger`. */ -extern struct lttng_error_query *lttng_error_query_action_create( +LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_action_create( const struct lttng_trigger *trigger, const struct lttng_action_path *action_path); /* Destroy an error query. */ -extern void lttng_error_query_destroy(struct lttng_error_query *query); +LTTNG_EXPORT extern void lttng_error_query_destroy(struct lttng_error_query *query); /* * Run an error query against an endpoint. @@ -84,45 +85,45 @@ extern void lttng_error_query_destroy(struct lttng_error_query *query); * Currently, only the `lttng_session_daemon_command_endpoint` is supported, * see `lttng/endpoint.h`. */ -extern enum lttng_error_code lttng_error_query_execute( +LTTNG_EXPORT extern enum lttng_error_code lttng_error_query_execute( const struct lttng_error_query *query, const struct lttng_endpoint *endpoint, struct lttng_error_query_results **results); /* Get the number of results in a result set. */ -extern enum lttng_error_query_results_status +LTTNG_EXPORT LTTNG_EXPORT extern enum lttng_error_query_results_status lttng_error_query_results_get_count( const struct lttng_error_query_results *results, unsigned int *count); /* Get a result from a result set by index. */ -extern enum lttng_error_query_results_status +LTTNG_EXPORT extern enum lttng_error_query_results_status lttng_error_query_results_get_result( const struct lttng_error_query_results *results, const struct lttng_error_query_result **result, unsigned int index); /* Destroy an error query result set. */ -extern void lttng_error_query_results_destroy( +LTTNG_EXPORT extern void lttng_error_query_results_destroy( struct lttng_error_query_results *results); /* Get the type of an error query result. */ -extern enum lttng_error_query_result_type lttng_error_query_result_get_type( +LTTNG_EXPORT extern enum lttng_error_query_result_type lttng_error_query_result_get_type( const struct lttng_error_query_result *result); /* Get the name of result. */ -extern enum lttng_error_query_result_status lttng_error_query_result_get_name( +LTTNG_EXPORT extern enum lttng_error_query_result_status lttng_error_query_result_get_name( const struct lttng_error_query_result *result, const char **name); /* Get the description of a result. */ -extern enum lttng_error_query_result_status +LTTNG_EXPORT extern enum lttng_error_query_result_status lttng_error_query_result_get_description( const struct lttng_error_query_result *result, const char **description); /* Get the value of an error counter. */ -extern enum lttng_error_query_result_status +LTTNG_EXPORT extern enum lttng_error_query_result_status lttng_error_query_result_counter_get_value( const struct lttng_error_query_result *result, uint64_t *value); diff --git a/include/lttng/event-expr.h b/include/lttng/event-expr.h index 911648779..cab22c97e 100644 --- a/include/lttng/event-expr.h +++ b/include/lttng/event-expr.h @@ -8,6 +8,7 @@ #ifndef LTTNG_EVENT_EXPR_H #define LTTNG_EVENT_EXPR_H +#include #include struct lttng_event_expr; @@ -83,7 +84,7 @@ enum lttng_event_expr_status { * Returns the type of the event expression `expr`, or * `LTTNG_EVENT_EXPR_TYPE_INVALID` if `expr` is `NULL`. */ -extern enum lttng_event_expr_type lttng_event_expr_get_type( +LTTNG_EXPORT extern enum lttng_event_expr_type lttng_event_expr_get_type( const struct lttng_event_expr *expr); /* @@ -95,7 +96,7 @@ extern enum lttng_event_expr_type lttng_event_expr_get_type( * * There's a memory error. * * `field_name` is `NULL`. */ -extern struct lttng_event_expr *lttng_event_expr_event_payload_field_create( +LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_event_payload_field_create( const char *field_name); /* @@ -106,7 +107,7 @@ extern struct lttng_event_expr *lttng_event_expr_event_payload_field_create( * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD`. */ -extern const char *lttng_event_expr_event_payload_field_get_name( +LTTNG_EXPORT extern const char *lttng_event_expr_event_payload_field_get_name( const struct lttng_event_expr *expr); /* @@ -118,7 +119,7 @@ extern const char *lttng_event_expr_event_payload_field_get_name( * * There's a memory error. * * `field_name` is `NULL`. */ -extern struct lttng_event_expr * +LTTNG_EXPORT extern struct lttng_event_expr * lttng_event_expr_channel_context_field_create(const char *field_name); /* @@ -129,7 +130,7 @@ lttng_event_expr_channel_context_field_create(const char *field_name); * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`. */ -extern const char *lttng_event_expr_channel_context_field_get_name( +LTTNG_EXPORT extern const char *lttng_event_expr_channel_context_field_get_name( const struct lttng_event_expr *expr); /* @@ -143,7 +144,7 @@ extern const char *lttng_event_expr_channel_context_field_get_name( * * `provider_name` is `NULL`. * * `type_name` is `NULL`. */ -extern struct lttng_event_expr * +LTTNG_EXPORT extern struct lttng_event_expr * lttng_event_expr_app_specific_context_field_create( const char *provider_name, const char *type_name); @@ -155,7 +156,7 @@ lttng_event_expr_app_specific_context_field_create( * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`. */ -extern const char * +LTTNG_EXPORT extern const char * lttng_event_expr_app_specific_context_field_get_provider_name( const struct lttng_event_expr *expr); @@ -167,7 +168,7 @@ lttng_event_expr_app_specific_context_field_get_provider_name( * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`. */ -extern const char * +LTTNG_EXPORT extern const char * lttng_event_expr_app_specific_context_field_get_type_name( const struct lttng_event_expr *expr); @@ -187,7 +188,7 @@ lttng_event_expr_app_specific_context_field_get_type_name( * * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` * * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */ -extern struct lttng_event_expr *lttng_event_expr_array_field_element_create( +LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_array_field_element_create( struct lttng_event_expr *array_field_expr, unsigned int index); @@ -199,7 +200,7 @@ extern struct lttng_event_expr *lttng_event_expr_array_field_element_create( * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT`. */ -extern const struct lttng_event_expr * +LTTNG_EXPORT extern const struct lttng_event_expr * lttng_event_expr_array_field_element_get_parent_expr( const struct lttng_event_expr *expr); @@ -218,7 +219,7 @@ lttng_event_expr_array_field_element_get_parent_expr( * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT`. * * `index` is `NULL`. */ -extern enum lttng_event_expr_status +LTTNG_EXPORT extern enum lttng_event_expr_status lttng_event_expr_array_field_element_get_index( const struct lttng_event_expr *expr, unsigned int *index); @@ -228,13 +229,13 @@ lttng_event_expr_array_field_element_get_index( * * `expr_a` and `expr_b` can be `NULL`. */ -extern bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a, +LTTNG_EXPORT extern bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a, const struct lttng_event_expr *expr_b); /* * Destroys the event expression `expr` if not `NULL`. */ -extern void lttng_event_expr_destroy(struct lttng_event_expr *expr); +LTTNG_EXPORT extern void lttng_event_expr_destroy(struct lttng_event_expr *expr); #ifdef __cplusplus } diff --git a/include/lttng/event-field-value.h b/include/lttng/event-field-value.h index 7fa851a79..02d93c661 100644 --- a/include/lttng/event-field-value.h +++ b/include/lttng/event-field-value.h @@ -8,6 +8,7 @@ #ifndef LTTNG_EVENT_FIELD_VALUE_H #define LTTNG_EVENT_FIELD_VALUE_H +#include #include struct lttng_event_field_value; @@ -103,7 +104,7 @@ enum lttng_event_field_value_status { * `LTTNG_EVENT_FIELD_VALUE_TYPE_INVALID`: * `field_val` is `NULL`. */ -extern enum lttng_event_field_value_type lttng_event_field_value_get_type( +LTTNG_EXPORT extern enum lttng_event_field_value_type lttng_event_field_value_get_type( const struct lttng_event_field_value *field_val); /* @@ -122,7 +123,7 @@ extern enum lttng_event_field_value_type lttng_event_field_value_get_type( * `LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM`. * * `val` is `NULL`. */ -extern enum lttng_event_field_value_status +LTTNG_EXPORT extern enum lttng_event_field_value_status lttng_event_field_value_unsigned_int_get_value( const struct lttng_event_field_value *field_val, uint64_t *val); @@ -142,7 +143,7 @@ lttng_event_field_value_unsigned_int_get_value( * `LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM`. * * `val` is `NULL`. */ -extern enum lttng_event_field_value_status +LTTNG_EXPORT extern enum lttng_event_field_value_status lttng_event_field_value_signed_int_get_value( const struct lttng_event_field_value *field_val, int64_t *val); @@ -161,7 +162,7 @@ lttng_event_field_value_signed_int_get_value( * `LTTNG_EVENT_FIELD_VALUE_TYPE_REAL`. * * `val` is `NULL`. */ -extern enum lttng_event_field_value_status +LTTNG_EXPORT extern enum lttng_event_field_value_status lttng_event_field_value_real_get_value( const struct lttng_event_field_value *field_val, double *val); @@ -177,7 +178,7 @@ lttng_event_field_value_real_get_value( * * The type of `field_val` is not * `LTTNG_EVENT_FIELD_VALUE_TYPE_STRING`. */ -extern enum lttng_event_field_value_status +LTTNG_EXPORT extern enum lttng_event_field_value_status lttng_event_field_value_string_get_value( const struct lttng_event_field_value *field_val, const char **value); @@ -197,7 +198,7 @@ lttng_event_field_value_string_get_value( * `LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY`. * * `length` is `NULL`. */ -extern enum lttng_event_field_value_status +LTTNG_EXPORT extern enum lttng_event_field_value_status lttng_event_field_value_array_get_length( const struct lttng_event_field_value *field_val, unsigned int *length); @@ -222,7 +223,7 @@ lttng_event_field_value_array_get_length( * * No event field value exists at index `index` within * `field_val`. */ -extern enum lttng_event_field_value_status +LTTNG_EXPORT extern enum lttng_event_field_value_status lttng_event_field_value_array_get_element_at_index( const struct lttng_event_field_value *field_val, unsigned int index, diff --git a/include/lttng/event-rule/event-rule.h b/include/lttng/event-rule/event-rule.h index a6dbb01a0..0c2453ccf 100644 --- a/include/lttng/event-rule/event-rule.h +++ b/include/lttng/event-rule/event-rule.h @@ -8,6 +8,8 @@ #ifndef LTTNG_EVENT_RULE_H #define LTTNG_EVENT_RULE_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -46,13 +48,13 @@ enum lttng_event_rule_status { * Returns the type of an event rule on success, LTTNG_EVENT_RULE_UNKNOWN on * error. */ -extern enum lttng_event_rule_type lttng_event_rule_get_type( +LTTNG_EXPORT extern enum lttng_event_rule_type lttng_event_rule_get_type( const struct lttng_event_rule *event_rule); /* * Destroy an event rule object. */ -extern void lttng_event_rule_destroy(struct lttng_event_rule *rule); +LTTNG_EXPORT extern void lttng_event_rule_destroy(struct lttng_event_rule *rule); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/jul-logging.h b/include/lttng/event-rule/jul-logging.h index 943adde8a..833e6adff 100644 --- a/include/lttng/event-rule/jul-logging.h +++ b/include/lttng/event-rule/jul-logging.h @@ -10,6 +10,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -24,7 +25,7 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_jul_logging_create(void); +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_jul_logging_create(void); /* * Set the name pattern of a jul logging event rule. @@ -34,7 +35,7 @@ extern struct lttng_event_rule *lttng_event_rule_jul_logging_create(void); * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_name_pattern( struct lttng_event_rule *rule, const char *pattern); /* @@ -49,7 +50,7 @@ extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_name_patter * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_name_pattern( const struct lttng_event_rule *rule, const char **pattern); /* @@ -60,7 +61,7 @@ extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_name_patter * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter( struct lttng_event_rule *rule, const char *expression); /* @@ -75,7 +76,7 @@ extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter( * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter( const struct lttng_event_rule *rule, const char **expression); /* @@ -86,7 +87,7 @@ extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter( * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_log_level_rule(struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule); @@ -102,7 +103,7 @@ lttng_event_rule_jul_logging_set_log_level_rule(struct lttng_event_rule *rule, * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior * to this call. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_log_level_rule( const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule); diff --git a/include/lttng/event-rule/kernel-kprobe.h b/include/lttng/event-rule/kernel-kprobe.h index 95f0002a3..c970116af 100644 --- a/include/lttng/event-rule/kernel-kprobe.h +++ b/include/lttng/event-rule/kernel-kprobe.h @@ -9,6 +9,7 @@ #define LTTNG_EVENT_RULE_KERNEL_KPROBE_H #include +#include #ifdef __cplusplus extern "C" { @@ -24,7 +25,7 @@ struct lttng_kernel_probe_location; * Returns a new event rule on success, NULL on failure. The returned event rule * must be destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create( +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create( const struct lttng_kernel_probe_location *location); /* @@ -39,7 +40,7 @@ extern struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create( * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to * this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_location( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_location( const struct lttng_event_rule *rule, const struct lttng_kernel_probe_location **location); @@ -51,7 +52,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_location( * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_set_event_name( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_set_event_name( struct lttng_event_rule *rule, const char *name); /* @@ -65,7 +66,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_set_event_nam * success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_EVENT_RULE_STATUS_UNSET if a name was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_event_name( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_event_name( const struct lttng_event_rule *rule, const char **name); #ifdef __cplusplus diff --git a/include/lttng/event-rule/kernel-syscall.h b/include/lttng/event-rule/kernel-syscall.h index 1db691587..ce8be6a5d 100644 --- a/include/lttng/event-rule/kernel-syscall.h +++ b/include/lttng/event-rule/kernel-syscall.h @@ -9,6 +9,7 @@ #define LTTNG_EVENT_RULE_KERNEL_SYSCALL_H #include +#include #ifdef __cplusplus extern "C" { @@ -30,7 +31,7 @@ enum lttng_event_rule_kernel_syscall_emission_site { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(enum +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(enum lttng_event_rule_kernel_syscall_emission_site emission_site); /* @@ -43,7 +44,7 @@ extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(enum * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pattern( struct lttng_event_rule *rule, const char *pattern); /* @@ -58,7 +59,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pat * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_name_pattern( const struct lttng_event_rule *rule, const char **pattern); /* @@ -69,7 +70,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_name_pat * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter( struct lttng_event_rule *rule, const char *expression); /* @@ -84,7 +85,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter( * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter( const struct lttng_event_rule *rule, const char **expression); /* @@ -92,7 +93,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter( * * Returns a enum lttng_event_rule_kernel_syscall_emission_site. */ -extern enum lttng_event_rule_kernel_syscall_emission_site +LTTNG_EXPORT extern enum lttng_event_rule_kernel_syscall_emission_site lttng_event_rule_kernel_syscall_get_emission_site( const struct lttng_event_rule *rule); diff --git a/include/lttng/event-rule/kernel-tracepoint.h b/include/lttng/event-rule/kernel-tracepoint.h index 84aa011e0..550a04ac4 100644 --- a/include/lttng/event-rule/kernel-tracepoint.h +++ b/include/lttng/event-rule/kernel-tracepoint.h @@ -10,6 +10,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -23,7 +24,7 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void); +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void); /* * Set the name pattern of a kernel tracepoint event rule. @@ -33,7 +34,7 @@ extern struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void); * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_pattern( struct lttng_event_rule *rule, const char *pattern); /* @@ -48,7 +49,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_ * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_pattern( const struct lttng_event_rule *rule, const char **pattern); /* @@ -59,7 +60,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_ * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filter( struct lttng_event_rule *rule, const char *expression); /* @@ -74,7 +75,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filte * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter( const struct lttng_event_rule *rule, const char **expression); #ifdef __cplusplus diff --git a/include/lttng/event-rule/kernel-uprobe.h b/include/lttng/event-rule/kernel-uprobe.h index 06712df32..6b29b695d 100644 --- a/include/lttng/event-rule/kernel-uprobe.h +++ b/include/lttng/event-rule/kernel-uprobe.h @@ -9,6 +9,7 @@ #define LTTNG_EVENT_RULE_KERNEL_UPROBE_H #include +#include #include #ifdef __cplusplus @@ -23,7 +24,7 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create( +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create( const struct lttng_userspace_probe_location *location); /* @@ -38,7 +39,7 @@ extern struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create( * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to * this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_location( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_location( const struct lttng_event_rule *rule, const struct lttng_userspace_probe_location **location); @@ -50,7 +51,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_location( * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_set_event_name( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_set_event_name( struct lttng_event_rule *rule, const char *name); /* @@ -64,7 +65,7 @@ extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_set_event_nam * success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_EVENT_RULE_STATUS_UNSET if a name was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_event_name( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_event_name( const struct lttng_event_rule *rule, const char **name); #ifdef __cplusplus diff --git a/include/lttng/event-rule/log4j-logging.h b/include/lttng/event-rule/log4j-logging.h index 1514a06f0..277e7d950 100644 --- a/include/lttng/event-rule/log4j-logging.h +++ b/include/lttng/event-rule/log4j-logging.h @@ -10,6 +10,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -24,7 +25,7 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_log4j_logging_create(void); +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_log4j_logging_create(void); /* * Set the name pattern of a log4j logging event rule. @@ -34,7 +35,7 @@ extern struct lttng_event_rule *lttng_event_rule_log4j_logging_create(void); * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_name_pattern( struct lttng_event_rule *rule, const char *pattern); /* @@ -49,7 +50,7 @@ extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_name_patt * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_name_pattern( const struct lttng_event_rule *rule, const char **pattern); /* @@ -60,7 +61,7 @@ extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_name_patt * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_filter( struct lttng_event_rule *rule, const char *expression); /* @@ -75,7 +76,7 @@ extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_filter( * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter( const struct lttng_event_rule *rule, const char **expression); /* @@ -86,7 +87,7 @@ extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter( * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_log_level_rule(struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule); @@ -102,7 +103,7 @@ lttng_event_rule_log4j_logging_set_log_level_rule(struct lttng_event_rule *rule, * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior * to this call. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_log_level_rule( const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule); diff --git a/include/lttng/event-rule/python-logging.h b/include/lttng/event-rule/python-logging.h index cb1f7a985..d4a6ada47 100644 --- a/include/lttng/event-rule/python-logging.h +++ b/include/lttng/event-rule/python-logging.h @@ -10,6 +10,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -24,7 +25,7 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_python_logging_create(void); +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_python_logging_create(void); /* * Set the name pattern of a python logging event rule. @@ -34,7 +35,7 @@ extern struct lttng_event_rule *lttng_event_rule_python_logging_create(void); * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_name_pattern( struct lttng_event_rule *rule, const char *pattern); /* @@ -49,7 +50,7 @@ extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_name_pat * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_name_pattern( const struct lttng_event_rule *rule, const char **pattern); /* @@ -60,7 +61,7 @@ extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_name_pat * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_filter( struct lttng_event_rule *rule, const char *expression); /* @@ -75,7 +76,7 @@ extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_filter( * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter( const struct lttng_event_rule *rule, const char **expression); /* @@ -86,7 +87,7 @@ extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter( * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_log_level_rule(struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule); @@ -102,7 +103,7 @@ lttng_event_rule_python_logging_set_log_level_rule(struct lttng_event_rule *rule * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior * to this call. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_log_level_rule( const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule); diff --git a/include/lttng/event-rule/user-tracepoint.h b/include/lttng/event-rule/user-tracepoint.h index 8744d3594..7ee91ce79 100644 --- a/include/lttng/event-rule/user-tracepoint.h +++ b/include/lttng/event-rule/user-tracepoint.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -25,7 +26,7 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void); +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void); /* * Set the name pattern of a user tracepoint event rule. @@ -35,7 +36,7 @@ extern struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void); * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pattern( struct lttng_event_rule *rule, const char *pattern); /* @@ -50,7 +51,7 @@ extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pa * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern( const struct lttng_event_rule *rule, const char **pattern); /* @@ -61,7 +62,7 @@ extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pa * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter( struct lttng_event_rule *rule, const char *expression); /* @@ -76,7 +77,7 @@ extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter( * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter( const struct lttng_event_rule *rule, const char **expression); /* @@ -87,7 +88,7 @@ extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter( * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_log_level_rule(struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule); @@ -103,7 +104,7 @@ lttng_event_rule_user_tracepoint_set_log_level_rule(struct lttng_event_rule *rul * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior * to this call. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_log_level_rule( const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule); @@ -116,7 +117,7 @@ lttng_event_rule_user_tracepoint_get_log_level_rule( * Returns LTTNG_EVENT_RULE_STATUS_OK on success, * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pattern_exclusion( +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pattern_exclusion( struct lttng_event_rule *rule, const char *exclusion); @@ -127,7 +128,7 @@ extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pa * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is * passed. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count( const struct lttng_event_rule *rule, unsigned int *count); @@ -138,7 +139,7 @@ lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count( * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is * passed. */ -extern enum lttng_event_rule_status +LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index( const struct lttng_event_rule *rule, unsigned int index, diff --git a/include/lttng/event.h b/include/lttng/event.h index 12d0ecc68..5915db6d6 100644 --- a/include/lttng/event.h +++ b/include/lttng/event.h @@ -9,13 +9,14 @@ #ifndef LTTNG_EVENT_H #define LTTNG_EVENT_H +#include +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - /* * Instrumentation type of tracing event. */ @@ -310,7 +311,7 @@ struct lttng_event_field { * Return the size (number of entries) of the "lttng_event" array. Caller must * free events. On error a negative LTTng error code is returned. */ -extern int lttng_list_events(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_list_events(struct lttng_handle *handle, const char *channel_name, struct lttng_event **events); /* @@ -329,7 +330,7 @@ extern int lttng_list_events(struct lttng_handle *handle, * * Returns a zeroed lttng_event on success, NULL on error. */ -extern struct lttng_event *lttng_event_create(void); +LTTNG_EXPORT extern struct lttng_event *lttng_event_create(void); /* * Destroy an lttng_event. @@ -337,7 +338,7 @@ extern struct lttng_event *lttng_event_create(void); * This destruction function, introduced in LTTng 2.11, should only * be used with events created by lttng_event_create(). */ -extern void lttng_event_destroy(struct lttng_event *event); +LTTNG_EXPORT extern void lttng_event_destroy(struct lttng_event *event); /* * Get the filter expression of a specific LTTng event. @@ -349,7 +350,7 @@ extern void lttng_event_destroy(struct lttng_event *event); * * Returns 0 on success, or a negative LTTng error code on error. */ -extern int lttng_event_get_filter_expression(struct lttng_event *event, +LTTNG_EXPORT extern int lttng_event_get_filter_expression(struct lttng_event *event, const char **filter_string); /* @@ -358,7 +359,7 @@ extern int lttng_event_get_filter_expression(struct lttng_event *event, * Returns the number of exclusion names on success, or a negative * LTTng error code on error. */ -extern int lttng_event_get_exclusion_name_count(struct lttng_event *event); +LTTNG_EXPORT extern int lttng_event_get_exclusion_name_count(struct lttng_event *event); /* * Get an LTTng event's exclusion name at a given index. @@ -368,7 +369,7 @@ extern int lttng_event_get_exclusion_name_count(struct lttng_event *event); * * Returns 0 on success, or a negative LTTng error code on error. */ -extern int lttng_event_get_exclusion_name(struct lttng_event *event, +LTTNG_EXPORT extern int lttng_event_get_exclusion_name(struct lttng_event *event, size_t index, const char **exclusion_name); /* @@ -377,7 +378,7 @@ extern int lttng_event_get_exclusion_name(struct lttng_event *event, * If the event has no probe location a NULL pointer is returned. The caller * does not own the returned probe location. */ -extern const struct lttng_userspace_probe_location * +LTTNG_EXPORT extern const struct lttng_userspace_probe_location * lttng_event_get_userspace_probe_location(const struct lttng_event *event); /* @@ -391,7 +392,7 @@ lttng_event_get_userspace_probe_location(const struct lttng_event *event); * * Returns 0 on success, or a negative LTTng error code on error. */ -extern int lttng_event_set_userspace_probe_location(struct lttng_event *event, +LTTNG_EXPORT extern int lttng_event_set_userspace_probe_location(struct lttng_event *event, struct lttng_userspace_probe_location *probe_location); /* @@ -402,7 +403,7 @@ extern int lttng_event_set_userspace_probe_location(struct lttng_event *event, * Return the size (number of entries) of the "lttng_event" array. Caller must * free events. On error a negative LTTng error code is returned. */ -extern int lttng_list_tracepoints(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event **events); /* @@ -414,7 +415,7 @@ extern int lttng_list_tracepoints(struct lttng_handle *handle, * Caller must free fields. On error a negative LTTng error code is * returned. */ -extern int lttng_list_tracepoint_fields(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_list_tracepoint_fields(struct lttng_handle *handle, struct lttng_event_field **fields); /* @@ -424,7 +425,7 @@ extern int lttng_list_tracepoint_fields(struct lttng_handle *handle, * All events in will be of type syscall. Caller must free events. On error a * negative LTTng error code is returned. */ -extern int lttng_list_syscalls(struct lttng_event **events); +LTTNG_EXPORT extern int lttng_list_syscalls(struct lttng_event **events); /* * Add context to event(s) for a specific channel (or for all). @@ -438,7 +439,7 @@ extern int lttng_list_syscalls(struct lttng_event **events); * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_add_context(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_add_context(struct lttng_handle *handle, struct lttng_event_context *ctx, const char *event_name, const char *channel_name); @@ -453,7 +454,7 @@ extern int lttng_add_context(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_enable_event(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_enable_event(struct lttng_handle *handle, struct lttng_event *ev, const char *channel_name); /* @@ -469,7 +470,7 @@ extern int lttng_enable_event(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_enable_event_with_filter(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_enable_event_with_filter(struct lttng_handle *handle, struct lttng_event *event, const char *channel_name, const char *filter_expression); @@ -487,7 +488,7 @@ extern int lttng_enable_event_with_filter(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_enable_event_with_exclusions(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_enable_event_with_exclusions(struct lttng_handle *handle, struct lttng_event *event, const char *channel_name, const char *filter_expression, int exclusion_count, char **exclusion_names); @@ -500,7 +501,7 @@ extern int lttng_enable_event_with_exclusions(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_disable_event(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_disable_event(struct lttng_handle *handle, const char *name, const char *channel_name); /* @@ -516,7 +517,7 @@ extern int lttng_disable_event(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_disable_event_ext(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_disable_event_ext(struct lttng_handle *handle, struct lttng_event *ev, const char *channel_name, const char *filter_expression); diff --git a/include/lttng/handle.h b/include/lttng/handle.h index 10ec82c62..efc889f1d 100644 --- a/include/lttng/handle.h +++ b/include/lttng/handle.h @@ -9,6 +9,7 @@ #define LTTNG_HANDLE_H #include +#include #ifdef __cplusplus extern "C" { @@ -40,7 +41,7 @@ struct lttng_handle { * Return a newly allocated handle that should be freed using * lttng_destroy_handle. On error, NULL is returned. */ -extern struct lttng_handle *lttng_create_handle(const char *session_name, +LTTNG_EXPORT extern struct lttng_handle *lttng_create_handle(const char *session_name, struct lttng_domain *domain); /* @@ -48,7 +49,7 @@ extern struct lttng_handle *lttng_create_handle(const char *session_name, * * It free the given pointer making it unusable. */ -extern void lttng_destroy_handle(struct lttng_handle *handle); +LTTNG_EXPORT extern void lttng_destroy_handle(struct lttng_handle *handle); #ifdef __cplusplus diff --git a/include/lttng/health.h b/include/lttng/health.h index 0256cbea8..26e885705 100644 --- a/include/lttng/health.h +++ b/include/lttng/health.h @@ -9,6 +9,8 @@ * */ +#include + #ifdef __cplusplus extern "C" { #endif @@ -29,7 +31,7 @@ enum lttng_health_consumerd { * * Return a newly allocated health object, or NULL on error. */ -extern struct lttng_health *lttng_health_create_sessiond(void); +LTTNG_EXPORT extern struct lttng_health *lttng_health_create_sessiond(void); /** * lttng_health_create_consumerd - Create consumerd health object @@ -37,7 +39,7 @@ extern struct lttng_health *lttng_health_create_sessiond(void); * * Return a newly allocated health object, or NULL on error. */ -extern struct lttng_health * +LTTNG_EXPORT extern struct lttng_health * lttng_health_create_consumerd(enum lttng_health_consumerd consumerd); /** @@ -49,13 +51,13 @@ extern struct lttng_health * * * Return a newly allocated health object, or NULL on error. */ -extern struct lttng_health *lttng_health_create_relayd(const char *path); +LTTNG_EXPORT extern struct lttng_health *lttng_health_create_relayd(const char *path); /** * lttng_health_destroy - Destroy health object * @health: health object to destroy */ -extern void lttng_health_destroy(struct lttng_health *health); +LTTNG_EXPORT extern void lttng_health_destroy(struct lttng_health *health); /** * lttng_health_query - Query component health @@ -65,7 +67,7 @@ extern void lttng_health_destroy(struct lttng_health *health); * reports if the query has been successfully performed, *NOT* the * actual state. lttng_health_state() should be used for the latter. */ -extern int lttng_health_query(struct lttng_health *health); +LTTNG_EXPORT extern int lttng_health_query(struct lttng_health *health); /** * lttng_health_state - Inspect the state of a health structure @@ -78,7 +80,7 @@ extern int lttng_health_query(struct lttng_health *health); * thread in error. It also returns a negative return value if * lttng_health_query() has not yet successfully completed on @health. */ -extern int lttng_health_state(const struct lttng_health *health); +LTTNG_EXPORT extern int lttng_health_state(const struct lttng_health *health); /** * lttng_health_get_nr_threads - Get number of threads in health component @@ -87,7 +89,7 @@ extern int lttng_health_state(const struct lttng_health *health); * Return the number of threads (>= 0) on success, else negative value * on error. */ -extern int lttng_health_get_nr_threads(const struct lttng_health *health); +LTTNG_EXPORT extern int lttng_health_get_nr_threads(const struct lttng_health *health); /** * lttng_health_get_thread - Get thread health @@ -98,7 +100,7 @@ extern int lttng_health_get_nr_threads(const struct lttng_health *health); * pointer should not be freed by the caller, and can be used until * lttng_health_destroy() is called on @health. */ -extern const struct lttng_health_thread * +LTTNG_EXPORT extern const struct lttng_health_thread * lttng_health_get_thread(const struct lttng_health *health, unsigned int nth_thread); @@ -108,7 +110,7 @@ extern const struct lttng_health_thread * * * Return 0 if thread is OK, else negative error value. */ -extern int lttng_health_thread_state(const struct lttng_health_thread *thread); +LTTNG_EXPORT extern int lttng_health_thread_state(const struct lttng_health_thread *thread); /** * lttng_health_thread_name - Get thread name @@ -116,7 +118,7 @@ extern int lttng_health_thread_state(const struct lttng_health_thread *thread); * * Return thread name, NULL on error. */ -extern const char *lttng_health_thread_name(const struct lttng_health_thread *thread); +LTTNG_EXPORT extern const char *lttng_health_thread_name(const struct lttng_health_thread *thread); #ifdef __cplusplus } diff --git a/include/lttng/kernel-probe.h b/include/lttng/kernel-probe.h index 4536fd5ef..cdd617dea 100644 --- a/include/lttng/kernel-probe.h +++ b/include/lttng/kernel-probe.h @@ -8,6 +8,7 @@ #ifndef LTTNG_KERNEL_PROBE_H #define LTTNG_KERNEL_PROBE_H +#include #include #ifdef __cplusplus @@ -33,34 +34,34 @@ enum lttng_kernel_probe_location_type { /* * Get the type of the kernel probe location. */ -extern enum lttng_kernel_probe_location_type +LTTNG_EXPORT extern enum lttng_kernel_probe_location_type lttng_kernel_probe_location_get_type( const struct lttng_kernel_probe_location *location); /* * Destroy the kernel probe location. */ -extern void lttng_kernel_probe_location_destroy( +LTTNG_EXPORT extern void lttng_kernel_probe_location_destroy( struct lttng_kernel_probe_location *location); /* * Create a symbol derived probe location. * On failure, NULL is returned. */ -extern struct lttng_kernel_probe_location * +LTTNG_EXPORT extern struct lttng_kernel_probe_location * lttng_kernel_probe_location_symbol_create(const char *symbol_name, uint64_t offset); /* * Get the symbol name of a symbol derived probe location. */ -extern const char *lttng_kernel_probe_location_symbol_get_name( +LTTNG_EXPORT extern const char *lttng_kernel_probe_location_symbol_get_name( const struct lttng_kernel_probe_location *location); /* * Get the offset of a symbol derived location. */ -extern enum lttng_kernel_probe_location_status +LTTNG_EXPORT extern enum lttng_kernel_probe_location_status lttng_kernel_probe_location_symbol_get_offset( const struct lttng_kernel_probe_location *location, uint64_t *offset); @@ -69,13 +70,13 @@ lttng_kernel_probe_location_symbol_get_offset( * Create an address derived probe location. * On failure, NULL is returned. */ -extern struct lttng_kernel_probe_location * +LTTNG_EXPORT extern struct lttng_kernel_probe_location * lttng_kernel_probe_location_address_create(uint64_t address); /* * Get the address of an address derived probe location. */ -extern enum lttng_kernel_probe_location_status +LTTNG_EXPORT extern enum lttng_kernel_probe_location_status lttng_kernel_probe_location_address_get_address( const struct lttng_kernel_probe_location *location, uint64_t *offset); diff --git a/include/lttng/load.h b/include/lttng/load.h index ea541e45b..0395bb414 100644 --- a/include/lttng/load.h +++ b/include/lttng/load.h @@ -9,6 +9,8 @@ #ifndef LTTNG_LOAD_H #define LTTNG_LOAD_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -22,12 +24,12 @@ struct lttng_load_session_attr; /* * Return a newly allocated load session attribute object or NULL on error. */ -extern struct lttng_load_session_attr *lttng_load_session_attr_create(void); +LTTNG_EXPORT extern struct lttng_load_session_attr *lttng_load_session_attr_create(void); /* * Free a given load session attribute object. */ -extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr); /* @@ -35,14 +37,14 @@ extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr */ /* Return session name. NULL indicates all sessions must be loaded. */ -extern const char *lttng_load_session_attr_get_session_name( +LTTNG_EXPORT extern const char *lttng_load_session_attr_get_session_name( struct lttng_load_session_attr *attr); /* * Return input URL. A NULL value indicates the default session * configuration location. The URL format used is documented in lttng-create(1). * NULL indicates that the default session configuration path is used. */ -extern const char *lttng_load_session_attr_get_input_url( +LTTNG_EXPORT extern const char *lttng_load_session_attr_get_input_url( struct lttng_load_session_attr *attr); /* @@ -51,7 +53,7 @@ extern const char *lttng_load_session_attr_get_input_url( * same name already exists. If such a session exists, it is destroyed before * the replacement is loaded. */ -extern int lttng_load_session_attr_get_overwrite( +LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite( struct lttng_load_session_attr *attr); /* @@ -61,7 +63,7 @@ extern int lttng_load_session_attr_get_overwrite( * * NULL indicates no override will be applied on configuration load. */ -extern const char *lttng_load_session_attr_get_override_url( +LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_url( struct lttng_load_session_attr *attr); /* @@ -71,7 +73,7 @@ extern const char *lttng_load_session_attr_get_override_url( * * NULL indicates no control URL override will be applied on configuration load. */ -extern const char *lttng_load_session_attr_get_override_ctrl_url( +LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_ctrl_url( struct lttng_load_session_attr *attr); /* @@ -81,7 +83,7 @@ extern const char *lttng_load_session_attr_get_override_ctrl_url( * * NULL indicates no data URL override will be applied on configuration load. */ -extern const char *lttng_load_session_attr_get_override_data_url( +LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_data_url( struct lttng_load_session_attr *attr); /* @@ -92,7 +94,7 @@ extern const char *lttng_load_session_attr_get_override_data_url( * NULL indicates no session name override will be applied on configuration * load. */ -extern const char *lttng_load_session_attr_get_override_session_name( +LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_session_name( struct lttng_load_session_attr *attr); /* @@ -106,7 +108,7 @@ extern const char *lttng_load_session_attr_get_override_session_name( * Set the name of the session to load. A NULL name means all sessions * found at the input URL will be loaded. */ -extern int lttng_load_session_attr_set_session_name( +LTTNG_EXPORT extern int lttng_load_session_attr_set_session_name( struct lttng_load_session_attr *attr, const char *session_name); /* @@ -115,7 +117,7 @@ extern int lttng_load_session_attr_set_session_name( * * Note that file:// is the only supported URL format. */ -extern int lttng_load_session_attr_set_input_url( +LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url( struct lttng_load_session_attr *attr, const char *url); /* @@ -123,7 +125,7 @@ extern int lttng_load_session_attr_set_input_url( * loaded sessions will be destroyed and be replaced by the session(s) being * loaded. */ -extern int lttng_load_session_attr_set_overwrite( +LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite( struct lttng_load_session_attr *attr, int overwrite); /* @@ -143,7 +145,7 @@ extern int lttng_load_session_attr_set_overwrite( * * See lttng-create(1) for more detail. */ -extern int lttng_load_session_attr_set_override_url( +LTTNG_EXPORT extern int lttng_load_session_attr_set_override_url( struct lttng_load_session_attr *attr, const char *url); /* @@ -156,7 +158,7 @@ extern int lttng_load_session_attr_set_override_url( * * See lttng-create(1) for more detail. */ -extern int lttng_load_session_attr_set_override_ctrl_url( +LTTNG_EXPORT extern int lttng_load_session_attr_set_override_ctrl_url( struct lttng_load_session_attr *attr, const char *url); /* @@ -169,7 +171,7 @@ extern int lttng_load_session_attr_set_override_ctrl_url( * * See lttng-create(1) for more detail. */ -extern int lttng_load_session_attr_set_override_data_url( +LTTNG_EXPORT extern int lttng_load_session_attr_set_override_data_url( struct lttng_load_session_attr *attr, const char *url); /* @@ -178,7 +180,7 @@ extern int lttng_load_session_attr_set_override_data_url( * Loading a configuration file defining multiple sessions will fail if a * session name is provided. */ -extern int lttng_load_session_attr_set_override_session_name( +LTTNG_EXPORT extern int lttng_load_session_attr_set_override_session_name( struct lttng_load_session_attr *attr, const char *session_name); /* @@ -189,7 +191,7 @@ extern int lttng_load_session_attr_set_override_session_name( * * Returns 0 on success or a negative LTTNG_ERR value on error. */ -extern int lttng_load_session(struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern int lttng_load_session(struct lttng_load_session_attr *attr); #ifdef __cplusplus } diff --git a/include/lttng/location.h b/include/lttng/location.h index d875b2484..ce686315e 100644 --- a/include/lttng/location.h +++ b/include/lttng/location.h @@ -8,6 +8,7 @@ #ifndef LTTNG_LOCATION_H #define LTTNG_LOCATION_H +#include #include #ifdef __cplusplus @@ -38,7 +39,7 @@ struct lttng_trace_archive_location; /* * Get a trace archive location's type. */ -extern enum lttng_trace_archive_location_type +LTTNG_EXPORT extern enum lttng_trace_archive_location_type lttng_trace_archive_location_get_type( const struct lttng_trace_archive_location *location); @@ -47,7 +48,7 @@ lttng_trace_archive_location_get_type( * * The trace archive location maintains ownership of the absolute_path. */ -extern enum lttng_trace_archive_location_status +LTTNG_EXPORT extern enum lttng_trace_archive_location_status lttng_trace_archive_location_local_get_absolute_path( const struct lttng_trace_archive_location *location, const char **absolute_path); @@ -58,7 +59,7 @@ lttng_trace_archive_location_local_get_absolute_path( * * The trace archive location maintains ownership of relay_host. */ -extern enum lttng_trace_archive_location_status +LTTNG_EXPORT extern enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_host( const struct lttng_trace_archive_location *location, const char **relay_host); @@ -67,7 +68,7 @@ lttng_trace_archive_location_relay_get_host( * Get the control port of the relay daemon associated to this trace archive * location. */ -extern enum lttng_trace_archive_location_status +LTTNG_EXPORT extern enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_control_port( const struct lttng_trace_archive_location *location, uint16_t *control_port); @@ -76,7 +77,7 @@ lttng_trace_archive_location_relay_get_control_port( * Get the data port of the relay daemon associated to this trace archive * location. */ -extern enum lttng_trace_archive_location_status +LTTNG_EXPORT extern enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_data_port( const struct lttng_trace_archive_location *location, uint16_t *data_port); @@ -85,7 +86,7 @@ lttng_trace_archive_location_relay_get_data_port( * Get the protocol used to communicate with the relay daemon associated to this * trace archive location. */ -extern enum lttng_trace_archive_location_status +LTTNG_EXPORT extern enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_protocol_type( const struct lttng_trace_archive_location *location, enum lttng_trace_archive_location_relay_protocol_type *protocol); @@ -95,7 +96,7 @@ lttng_trace_archive_location_relay_get_protocol_type( * * The trace archive location maintains ownership of relative_path. */ -extern enum lttng_trace_archive_location_status +LTTNG_EXPORT extern enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_relative_path( const struct lttng_trace_archive_location *location, const char **relative_path); diff --git a/include/lttng/log-level-rule.h b/include/lttng/log-level-rule.h index ea9045d56..ddb3501a1 100644 --- a/include/lttng/log-level-rule.h +++ b/include/lttng/log-level-rule.h @@ -8,6 +8,8 @@ #ifndef LTTNG_LOG_LEVEL_RULE_H #define LTTNG_LOG_LEVEL_RULE_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -32,7 +34,7 @@ enum lttng_log_level_rule_status { * `LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN`: * `rule` is `NULL`. */ -extern enum lttng_log_level_rule_type lttng_log_level_rule_get_type( +LTTNG_EXPORT extern enum lttng_log_level_rule_type lttng_log_level_rule_get_type( const struct lttng_log_level_rule *rule); /* @@ -46,7 +48,7 @@ extern enum lttng_log_level_rule_type lttng_log_level_rule_get_type( * The returned log level rule must be destroyed using * lttng_log_level_rule_destroy(). */ -extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create( +LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create( int level); /* @@ -62,7 +64,7 @@ extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create( * * `level` is NULL. * * The type of `rule` is not `LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY`. */ -extern enum lttng_log_level_rule_status lttng_log_level_rule_exactly_get_level( +LTTNG_EXPORT extern enum lttng_log_level_rule_status lttng_log_level_rule_exactly_get_level( const struct lttng_log_level_rule *rule, int *level); /* @@ -76,7 +78,7 @@ extern enum lttng_log_level_rule_status lttng_log_level_rule_exactly_get_level( * The returned log level rule must be destroyed using * lttng_log_level_rule_destroy(). */ -extern struct lttng_log_level_rule * +LTTNG_EXPORT extern struct lttng_log_level_rule * lttng_log_level_rule_at_least_as_severe_as_create(int level); /* @@ -94,14 +96,14 @@ lttng_log_level_rule_at_least_as_severe_as_create(int level); * * The type of `rule` is not * `LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS`. */ -extern enum lttng_log_level_rule_status +LTTNG_EXPORT extern enum lttng_log_level_rule_status lttng_log_level_rule_at_least_as_severe_as_get_level( const struct lttng_log_level_rule *rule, int *level); /* * Destroy the log level rule `log_level_rule` if not `NULL`. */ -extern void lttng_log_level_rule_destroy( +LTTNG_EXPORT extern void lttng_log_level_rule_destroy( struct lttng_log_level_rule *log_level_rule); #ifdef __cplusplus diff --git a/include/lttng/lttng-error.h b/include/lttng/lttng-error.h index aadf2f45b..790a78a0b 100644 --- a/include/lttng/lttng-error.h +++ b/include/lttng/lttng-error.h @@ -15,6 +15,8 @@ #ifndef LTTNG_ERROR_H #define LTTNG_ERROR_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -195,7 +197,7 @@ enum lttng_error_code { * * Parameter MUST be a negative value or else you'll get a generic message. */ -extern const char *lttng_strerror(int code); +LTTNG_EXPORT extern const char *lttng_strerror(int code); #ifdef __cplusplus } diff --git a/include/lttng/lttng-export.h b/include/lttng/lttng-export.h new file mode 100644 index 000000000..ae3990a29 --- /dev/null +++ b/include/lttng/lttng-export.h @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2021 Simon Marchi + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ +#ifndef LTTNG_EXPORT_H +#define LTTNG_EXPORT_H +#if defined(_WIN32) || defined(__CYGWIN__) +# define LTTNG_EXPORT +#else +# define LTTNG_EXPORT __attribute__((visibility("default"))) +#endif +#endif diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index efbd92f5d..825b6682b 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -95,14 +96,14 @@ struct lttng_calibrate { * Return 1 if alive or 0 if not. On error, returns a negative negative LTTng * error code. */ -extern int lttng_session_daemon_alive(void); +LTTNG_EXPORT extern int lttng_session_daemon_alive(void); /* * Set the tracing group for the *current* flow of execution. * * On success, returns 0 else a negative LTTng error code. */ -extern int lttng_set_tracing_group(const char *name); +LTTNG_EXPORT extern int lttng_set_tracing_group(const char *name); /* * This call registers an "outside consumer" for a session and an lttng domain. @@ -114,7 +115,7 @@ extern int lttng_set_tracing_group(const char *name); * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_register_consumer(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_register_consumer(struct lttng_handle *handle, const char *socket_path); /* @@ -122,7 +123,7 @@ extern int lttng_register_consumer(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_start_tracing(const char *session_name); +LTTNG_EXPORT extern int lttng_start_tracing(const char *session_name); /* * Stop tracing for *all* domain(s) in the session. @@ -136,13 +137,13 @@ extern int lttng_start_tracing(const char *session_name); * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_stop_tracing(const char *session_name); +LTTNG_EXPORT extern int lttng_stop_tracing(const char *session_name); /* * Behave exactly like lttng_stop_tracing but does not wait for data * availability. */ -extern int lttng_stop_tracing_no_wait(const char *session_name); +LTTNG_EXPORT extern int lttng_stop_tracing_no_wait(const char *session_name); /* * Deprecated: As of LTTng 2.9, this function always returns @@ -150,7 +151,7 @@ extern int lttng_stop_tracing_no_wait(const char *session_name); */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" -extern int lttng_calibrate(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_calibrate(struct lttng_handle *handle, struct lttng_calibrate *calibrate); #pragma GCC diagnostic pop @@ -178,7 +179,7 @@ extern int lttng_calibrate(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_set_consumer_url(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_set_consumer_url(struct lttng_handle *handle, const char *control_url, const char *data_url); /* @@ -191,13 +192,13 @@ extern int lttng_set_consumer_url(struct lttng_handle *handle, * traced data is pending. On error, a negative value is returned and readable * by lttng_strerror(). */ -extern int lttng_data_pending(const char *session_name); +LTTNG_EXPORT extern int lttng_data_pending(const char *session_name); /* * Deprecated, replaced by lttng_regenerate_metadata. */ LTTNG_DEPRECATED("Use lttng_regenerate_metadata") -extern int lttng_metadata_regenerate(const char *session_name); +LTTNG_EXPORT extern int lttng_metadata_regenerate(const char *session_name); /* * Trigger the regeneration of the metadata for a session. @@ -205,7 +206,7 @@ extern int lttng_metadata_regenerate(const char *session_name); * the lttng-relayd). Only kernel, per-uid and non-live sessions are supported. * Return 0 on success, a negative LTTng error code on error. */ -extern int lttng_regenerate_metadata(const char *session_name); +LTTNG_EXPORT extern int lttng_regenerate_metadata(const char *session_name); /* * Trigger the regeneration of the statedump for a session. The new statedump @@ -214,7 +215,7 @@ extern int lttng_regenerate_metadata(const char *session_name); * * Return 0 on success, a negative LTTng error code on error. */ -extern int lttng_regenerate_statedump(const char *session_name); +LTTNG_EXPORT extern int lttng_regenerate_statedump(const char *session_name); #ifdef __cplusplus } diff --git a/include/lttng/notification/channel.h b/include/lttng/notification/channel.h index 95a048fb9..030c88cbd 100644 --- a/include/lttng/notification/channel.h +++ b/include/lttng/notification/channel.h @@ -8,6 +8,7 @@ #ifndef LTTNG_NOTIFICATION_CHANNEL_H #define LTTNG_NOTIFICATION_CHANNEL_H +#include #include #ifdef __cplusplus @@ -57,7 +58,7 @@ enum lttng_notification_channel_status { * The returned lttng_notification_channel must be destroyed using * the lttng_notification_channel_destroy() function. */ -extern struct lttng_notification_channel *lttng_notification_channel_create( +LTTNG_EXPORT extern struct lttng_notification_channel *lttng_notification_channel_create( struct lttng_endpoint *endpoint); /* @@ -81,7 +82,7 @@ extern struct lttng_notification_channel *lttng_notification_channel_create( * - LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED if a signal was received * that caused the reception to fail. */ -extern enum lttng_notification_channel_status +LTTNG_EXPORT extern enum lttng_notification_channel_status lttng_notification_channel_get_next_notification( struct lttng_notification_channel *channel, struct lttng_notification **notification); @@ -102,7 +103,7 @@ lttng_notification_channel_get_next_notification( * - LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID if an invalid parameter was * provided. */ -extern enum lttng_notification_channel_status +LTTNG_EXPORT extern enum lttng_notification_channel_status lttng_notification_channel_has_pending_notification( struct lttng_notification_channel *channel, bool *notification_pending); @@ -122,7 +123,7 @@ lttng_notification_channel_has_pending_notification( * provided, or LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED if the * client was already subscribed to the condition through this channel. */ -extern enum lttng_notification_channel_status +LTTNG_EXPORT extern enum lttng_notification_channel_status lttng_notification_channel_subscribe( struct lttng_notification_channel *channel, const struct lttng_condition *condition); @@ -142,7 +143,7 @@ lttng_notification_channel_subscribe( * provided, or LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION if the * client was not already subscribed to the condition through this channel. */ -extern enum lttng_notification_channel_status +LTTNG_EXPORT extern enum lttng_notification_channel_status lttng_notification_channel_unsubscribe( struct lttng_notification_channel *channel, const struct lttng_condition *condition); @@ -150,7 +151,7 @@ lttng_notification_channel_unsubscribe( /* * Closes and destroys (frees) a notification channel. */ -extern void lttng_notification_channel_destroy( +LTTNG_EXPORT extern void lttng_notification_channel_destroy( struct lttng_notification_channel *channel); #ifdef __cplusplus diff --git a/include/lttng/notification/notification.h b/include/lttng/notification/notification.h index 69e17d30c..d1c088fec 100644 --- a/include/lttng/notification/notification.h +++ b/include/lttng/notification/notification.h @@ -8,6 +8,8 @@ #ifndef LTTNG_NOTIFICATION_H #define LTTNG_NOTIFICATION_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -28,7 +30,7 @@ struct lttng_notification; * * Returns an lttng_condition object on success, NULL on error. */ -extern const struct lttng_condition *lttng_notification_get_condition( +LTTNG_EXPORT extern const struct lttng_condition *lttng_notification_get_condition( struct lttng_notification *notification); /* @@ -43,7 +45,7 @@ extern const struct lttng_condition *lttng_notification_get_condition( * * Returns an lttng_evaluation object on success, NULL on error. */ -extern const struct lttng_evaluation *lttng_notification_get_evaluation( +LTTNG_EXPORT extern const struct lttng_evaluation *lttng_notification_get_evaluation( struct lttng_notification *notification); /* @@ -55,14 +57,14 @@ extern const struct lttng_evaluation *lttng_notification_get_evaluation( * * Returns an lttng_trigger object on success, NULL on error. */ -extern const struct lttng_trigger *lttng_notification_get_trigger( +LTTNG_EXPORT extern const struct lttng_trigger *lttng_notification_get_trigger( struct lttng_notification *notification); /* * Destroys (frees) a notification. The notification's condition and evaluation * are destroyed as a side-effect. */ -extern void lttng_notification_destroy(struct lttng_notification *notification); +LTTNG_EXPORT extern void lttng_notification_destroy(struct lttng_notification *notification); #ifdef __cplusplus } diff --git a/include/lttng/rotation.h b/include/lttng/rotation.h index 316f2cdb5..08f2a985b 100644 --- a/include/lttng/rotation.h +++ b/include/lttng/rotation.h @@ -11,6 +11,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -101,7 +102,7 @@ struct lttng_rotation_handle; * This will issue a request to the session daemon on every call. Hence, * the result of this call may change over time. */ -extern enum lttng_rotation_status lttng_rotation_handle_get_state( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_handle_get_state( struct lttng_rotation_handle *rotation_handle, enum lttng_rotation_state *rotation_state); @@ -114,14 +115,14 @@ extern enum lttng_rotation_status lttng_rotation_handle_get_state( * Note that location will not be set in case of error, or if the session * rotation handle has expired. */ -extern enum lttng_rotation_status lttng_rotation_handle_get_archive_location( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_handle_get_archive_location( struct lttng_rotation_handle *rotation_handle, const struct lttng_trace_archive_location **location); /* * Destroy an lttng_rotate_session handle. */ -extern void lttng_rotation_handle_destroy( +LTTNG_EXPORT extern void lttng_rotation_handle_destroy( struct lttng_rotation_handle *rotation_handle); /* @@ -137,21 +138,21 @@ extern void lttng_rotation_handle_destroy( * Return 0 if the rotate action was successfully launched or a negative * LTTng error code on error. */ -extern int lttng_rotate_session(const char *session_name, +LTTNG_EXPORT extern int lttng_rotate_session(const char *session_name, struct lttng_rotation_immediate_descriptor *descriptor, struct lttng_rotation_handle **rotation_handle); /* * Get the type of a rotation schedule object. */ -extern enum lttng_rotation_schedule_type lttng_rotation_schedule_get_type( +LTTNG_EXPORT extern enum lttng_rotation_schedule_type lttng_rotation_schedule_get_type( const struct lttng_rotation_schedule *schedule); /* * Return a newly allocated size-based session rotation schedule or NULL on * error. */ -extern struct lttng_rotation_schedule * +LTTNG_EXPORT extern struct lttng_rotation_schedule * lttng_rotation_schedule_size_threshold_create(void); /* @@ -160,7 +161,7 @@ lttng_rotation_schedule_size_threshold_create(void); * Returns LTTNG_ROTATION_STATUS_OK on success. * LTTNG_ROTATION_STATUS_UNAVAILABLE is returned if the value is unset. */ -extern enum lttng_rotation_status +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_size_threshold_get_threshold( const struct lttng_rotation_schedule *schedule, uint64_t *size_threshold_bytes); @@ -168,7 +169,7 @@ lttng_rotation_schedule_size_threshold_get_threshold( /* * Set a session rotation schedule's size threshold. */ -extern enum lttng_rotation_status +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_size_threshold_set_threshold( struct lttng_rotation_schedule *schedule, uint64_t size_threshold_bytes); @@ -177,7 +178,7 @@ lttng_rotation_schedule_size_threshold_set_threshold( * Return a newly allocated periodic session rotation schedule or NULL on * error. */ -extern struct lttng_rotation_schedule * +LTTNG_EXPORT extern struct lttng_rotation_schedule * lttng_rotation_schedule_periodic_create(void); /* @@ -186,34 +187,34 @@ lttng_rotation_schedule_periodic_create(void); * Returns LTTNG_ROTATION_STATUS_OK on success. * LTTNG_ROTATION_STATUS_UNAVAILABLE is returned if the value is unset. */ -extern enum lttng_rotation_status lttng_rotation_schedule_periodic_get_period( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_periodic_get_period( const struct lttng_rotation_schedule *schedule, uint64_t *period_us); /* * Set a time-based session rotation schedule's period. */ -extern enum lttng_rotation_status lttng_rotation_schedule_periodic_set_period( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_periodic_set_period( struct lttng_rotation_schedule *schedule, uint64_t period_us); /* * Destroy a rotation schedule. */ -extern void lttng_rotation_schedule_destroy( +LTTNG_EXPORT extern void lttng_rotation_schedule_destroy( struct lttng_rotation_schedule *schedule); /* * Destroy a set of rotation schedules. Pointers to any schedule contained * in this set become invalid after this call. */ -extern void lttng_rotation_schedules_destroy( +LTTNG_EXPORT extern void lttng_rotation_schedules_destroy( struct lttng_rotation_schedules *schedules); /* * Get the number of schedules in a schedule set. */ -extern enum lttng_rotation_status lttng_rotation_schedules_get_count( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedules_get_count( const struct lttng_rotation_schedules *schedules, unsigned int *count); @@ -226,7 +227,7 @@ extern enum lttng_rotation_status lttng_rotation_schedules_get_count( * * Returns a rotation schedule, or NULL on error. */ -extern const struct lttng_rotation_schedule * +LTTNG_EXPORT extern const struct lttng_rotation_schedule * lttng_rotation_schedules_get_at_index( const struct lttng_rotation_schedules *schedules, unsigned int index); @@ -241,7 +242,7 @@ lttng_rotation_schedules_get_at_index( * LTTNG_ROTATION_STATUS_SCHEDULE_ALREADY_SET if a rotation of the same type * is already set. */ -extern enum lttng_rotation_status lttng_session_add_rotation_schedule( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_add_rotation_schedule( const char *session_name, const struct lttng_rotation_schedule *schedule); @@ -252,7 +253,7 @@ extern enum lttng_rotation_status lttng_session_add_rotation_schedule( * LTTNG_ROTATION_STATUS_SCHEDULE_INVALID if the provided schedule is * not set. */ -extern enum lttng_rotation_status lttng_session_remove_rotation_schedule( +LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_remove_rotation_schedule( const char *session_name, const struct lttng_rotation_schedule *schedule); @@ -261,7 +262,7 @@ extern enum lttng_rotation_status lttng_session_remove_rotation_schedule( * * Returns LTTNG_OK on success, or a negative lttng error code on error. */ -extern int lttng_session_list_rotation_schedules( +LTTNG_EXPORT extern int lttng_session_list_rotation_schedules( const char *session_name, struct lttng_rotation_schedules **schedules); diff --git a/include/lttng/save.h b/include/lttng/save.h index 7dbe32698..d28fdffcd 100644 --- a/include/lttng/save.h +++ b/include/lttng/save.h @@ -8,6 +8,8 @@ #ifndef LTTNG_SAVE_H #define LTTNG_SAVE_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -21,12 +23,12 @@ struct lttng_save_session_attr; /* * Return a newly allocated save session attribute object or NULL on error. */ -extern struct lttng_save_session_attr *lttng_save_session_attr_create(void); +LTTNG_EXPORT extern struct lttng_save_session_attr *lttng_save_session_attr_create(void); /* * Free a given save session attribute object. */ -extern void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output); +LTTNG_EXPORT extern void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output); /* @@ -34,32 +36,32 @@ extern void lttng_save_session_attr_destroy(struct lttng_save_session_attr *outp */ /* Return session name. NULL indicated all sessions must be saved. */ -extern const char *lttng_save_session_attr_get_session_name( +LTTNG_EXPORT extern const char *lttng_save_session_attr_get_session_name( struct lttng_save_session_attr *attr); /* * Return destination URL. A NULL value indicates the default session * configuration location. The URL format used is documented in lttng(1). * NULL indicates that the default session configuration path is used. */ -extern const char *lttng_save_session_attr_get_output_url( +LTTNG_EXPORT extern const char *lttng_save_session_attr_get_output_url( struct lttng_save_session_attr *attr); /* * Return the configuration overwrite attribute. This attribute indicates * whether or not existing configuration files must be overwritten. */ -extern int lttng_save_session_attr_get_overwrite( +LTTNG_EXPORT extern int lttng_save_session_attr_get_overwrite( struct lttng_save_session_attr *attr); /* * Return the omit name configuration attribute. This attribute indicates * whether or not the saved sessions' names should be omitted. */ -extern int lttng_save_session_attr_get_omit_name( +LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_name( struct lttng_save_session_attr *attr); /* * Return the omit output configuration attribute. This attribute indicates * whether or not the saved sessions' output configuration should be omitted. */ -extern int lttng_save_session_attr_get_omit_output( +LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_output( struct lttng_save_session_attr *attr); /* @@ -73,32 +75,32 @@ extern int lttng_save_session_attr_get_omit_output( * Set the name of the session to save. A NULL name means all sessions * known to the session daemon will be saved. */ -extern int lttng_save_session_attr_set_session_name( +LTTNG_EXPORT extern int lttng_save_session_attr_set_session_name( struct lttng_save_session_attr *attr, const char *session_name); /* * Set the URL of the session configuration to save. A NULL value indicates the * use of the default location being the session one. The URL's format is is * documented in lttng(1). */ -extern int lttng_save_session_attr_set_output_url( +LTTNG_EXPORT extern int lttng_save_session_attr_set_output_url( struct lttng_save_session_attr *attr, const char *url); /* * Set the overwrite attribute. If set to true, files of the same name as the * current session configuration URL will be overwritten. */ -extern int lttng_save_session_attr_set_overwrite( +LTTNG_EXPORT extern int lttng_save_session_attr_set_overwrite( struct lttng_save_session_attr *attr, int overwrite); /* * Set the omit name attribute. If set to true, the sessions' names are omitted * from the resulting session configuration file. */ -extern int lttng_save_session_attr_set_omit_name( +LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_name( struct lttng_save_session_attr *attr, int omit_name); /* * Set the omit output attribute. If set to true, the sessions' output * configurations are omitted from the resulting session configuration file. */ -extern int lttng_save_session_attr_set_omit_output( +LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_output( struct lttng_save_session_attr *attr, int omit_output); /* @@ -109,7 +111,7 @@ extern int lttng_save_session_attr_set_omit_output( * * Returns 0 on success or a negative LTTNG_ERR value on error. */ -extern int lttng_save_session(struct lttng_save_session_attr *attr); +LTTNG_EXPORT extern int lttng_save_session(struct lttng_save_session_attr *attr); #ifdef __cplusplus } diff --git a/include/lttng/session-descriptor.h b/include/lttng/session-descriptor.h index 3fb28a78e..5db04be7e 100644 --- a/include/lttng/session-descriptor.h +++ b/include/lttng/session-descriptor.h @@ -8,6 +8,8 @@ #ifndef LTTNG_SESSION_DESCRIPTOR_H #define LTTNG_SESSION_DESCRIPTOR_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -103,7 +105,7 @@ enum lttng_session_descriptor_status { * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_create(const char *name); /* @@ -116,7 +118,7 @@ lttng_session_descriptor_create(const char *name); * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_local_create(const char *name, const char *path); /* @@ -129,7 +131,7 @@ lttng_session_descriptor_local_create(const char *name, const char *path); * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_network_create(const char *name, const char *control_url, const char *data_url); @@ -140,7 +142,7 @@ lttng_session_descriptor_network_create(const char *name, * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_snapshot_create(const char *name); /* @@ -153,7 +155,7 @@ lttng_session_descriptor_snapshot_create(const char *name); * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_snapshot_local_create(const char *name, const char *path); @@ -168,7 +170,7 @@ lttng_session_descriptor_snapshot_local_create(const char *name, * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_snapshot_network_create(const char *name, const char *control_url, const char *data_url); @@ -185,7 +187,7 @@ lttng_session_descriptor_snapshot_network_create(const char *name, * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_live_create( const char *name, unsigned long long live_timer_interval_us); @@ -205,7 +207,7 @@ lttng_session_descriptor_live_create( * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -extern struct lttng_session_descriptor * +LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_live_network_create( const char *name, const char *control_url, const char *data_url, @@ -226,7 +228,7 @@ lttng_session_descriptor_live_network_create( * NULL, and LTTNG_SESSION_DESCRIPTOR_STATUS_UNSET if the descriptor's * name parameter is unset. */ -extern enum lttng_session_descriptor_status +LTTNG_EXPORT extern enum lttng_session_descriptor_status lttng_session_descriptor_get_session_name( const struct lttng_session_descriptor *descriptor, const char **name); @@ -237,7 +239,7 @@ lttng_session_descriptor_get_session_name( * This does not destroy the session on the session daemon; it releases * the resources allocated by the descriptor object. */ -extern void lttng_session_descriptor_destroy( +LTTNG_EXPORT extern void lttng_session_descriptor_destroy( struct lttng_session_descriptor *descriptor); #ifdef __cplusplus diff --git a/include/lttng/session.h b/include/lttng/session.h index f13f83916..153a37b03 100644 --- a/include/lttng/session.h +++ b/include/lttng/session.h @@ -14,6 +14,7 @@ extern "C" { #endif #include +#include struct lttng_handle; struct lttng_session_descriptor; @@ -86,7 +87,7 @@ struct lttng_session { * Returns LTTNG_OK on success. See lttng-error.h for the meaning of the other * return codes. */ -extern enum lttng_error_code lttng_create_session_ext( +LTTNG_EXPORT extern enum lttng_error_code lttng_create_session_ext( struct lttng_session_descriptor *session_descriptor); /* @@ -97,7 +98,7 @@ extern enum lttng_error_code lttng_create_session_ext( * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_create_session(const char *name, const char *url); +LTTNG_EXPORT extern int lttng_create_session(const char *name, const char *url); /* * Create a tracing session that will exclusively be used for snapshot meaning @@ -111,7 +112,7 @@ extern int lttng_create_session(const char *name, const char *url); * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_create_session_snapshot(const char *name, +LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *name, const char *snapshot_url); /* @@ -127,7 +128,7 @@ extern int lttng_create_session_snapshot(const char *name, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_create_session_live(const char *name, const char *url, +LTTNG_EXPORT extern int lttng_create_session_live(const char *name, const char *url, unsigned int timer_interval); /* @@ -147,7 +148,7 @@ extern int lttng_create_session_live(const char *name, const char *url, * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_destroy_session(const char *name); +LTTNG_EXPORT extern int lttng_destroy_session(const char *name); /* * Destroy a tracing session. @@ -161,14 +162,14 @@ extern int lttng_destroy_session(const char *name); * Returns LTTNG_OK on success. The returned handle is owned by the caller * and must be free'd using lttng_destruction_handle_destroy(). */ -extern enum lttng_error_code lttng_destroy_session_ext(const char *session_name, +LTTNG_EXPORT extern enum lttng_error_code lttng_destroy_session_ext(const char *session_name, struct lttng_destruction_handle **handle); /* * Behaves exactly like lttng_destroy_session but does not wait for data * availability. */ -extern int lttng_destroy_session_no_wait(const char *name); +LTTNG_EXPORT extern int lttng_destroy_session_no_wait(const char *name); /* * List all the tracing sessions. @@ -178,7 +179,7 @@ extern int lttng_destroy_session_no_wait(const char *name); * * On error, a negative LTTng error code is returned. */ -extern int lttng_list_sessions(struct lttng_session **sessions); +LTTNG_EXPORT extern int lttng_list_sessions(struct lttng_session **sessions); /* * Get the creation time of an lttng_session object on the session daemon. @@ -192,7 +193,7 @@ extern int lttng_list_sessions(struct lttng_session **sessions); * Returns LTTNG_OK on success. See lttng-error.h for the meaning of the other * return codes. */ -extern enum lttng_error_code lttng_session_get_creation_time( +LTTNG_EXPORT extern enum lttng_error_code lttng_session_get_creation_time( const struct lttng_session *session, uint64_t *creation_time); /* @@ -204,7 +205,7 @@ extern enum lttng_error_code lttng_session_get_creation_time( * * Return 0 on success else a negative LTTng error code. */ -extern int lttng_set_session_shm_path(const char *session_name, +LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, const char *shm_path); #ifdef __cplusplus diff --git a/include/lttng/snapshot.h b/include/lttng/snapshot.h index bdbfb094f..b777e006b 100644 --- a/include/lttng/snapshot.h +++ b/include/lttng/snapshot.h @@ -9,6 +9,7 @@ #define LTTNG_SNAPSHOT_H #include +#include #include #include @@ -26,12 +27,12 @@ struct lttng_snapshot_output_list; /* * Return an newly allocated snapshot output object or NULL on error. */ -extern struct lttng_snapshot_output *lttng_snapshot_output_create(void); +LTTNG_EXPORT extern struct lttng_snapshot_output *lttng_snapshot_output_create(void); /* * Free a given snapshot output object. */ -extern void lttng_snapshot_output_destroy(struct lttng_snapshot_output *output); +LTTNG_EXPORT extern void lttng_snapshot_output_destroy(struct lttng_snapshot_output *output); /* * Snapshot output getter family functions. They all return the value present @@ -39,15 +40,15 @@ extern void lttng_snapshot_output_destroy(struct lttng_snapshot_output *output); */ /* Return snapshot ID. */ -extern uint32_t lttng_snapshot_output_get_id(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern uint32_t lttng_snapshot_output_get_id(const struct lttng_snapshot_output *output); /* Return maximum size of a snapshot. */ -extern uint64_t lttng_snapshot_output_get_maxsize(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern uint64_t lttng_snapshot_output_get_maxsize(const struct lttng_snapshot_output *output); /* Return snapshot name. */ -extern const char *lttng_snapshot_output_get_name(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern const char *lttng_snapshot_output_get_name(const struct lttng_snapshot_output *output); /* Return snapshot control URL in a text format. */ -extern const char *lttng_snapshot_output_get_ctrl_url(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern const char *lttng_snapshot_output_get_ctrl_url(const struct lttng_snapshot_output *output); /* Return snapshot data URL in a text format. */ -extern const char *lttng_snapshot_output_get_data_url(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern const char *lttng_snapshot_output_get_data_url(const struct lttng_snapshot_output *output); /* * Snapshot output setter family functions. @@ -57,13 +58,13 @@ extern const char *lttng_snapshot_output_get_data_url(const struct lttng_snapsho */ /* Set a custom ID. */ -extern int lttng_snapshot_output_set_id(uint32_t id, +LTTNG_EXPORT extern int lttng_snapshot_output_set_id(uint32_t id, struct lttng_snapshot_output *output); /* Set the maximum size. */ -extern int lttng_snapshot_output_set_size(uint64_t size, +LTTNG_EXPORT extern int lttng_snapshot_output_set_size(uint64_t size, struct lttng_snapshot_output *output); /* Set the snapshot name. */ -extern int lttng_snapshot_output_set_name(const char *name, +LTTNG_EXPORT extern int lttng_snapshot_output_set_name(const char *name, struct lttng_snapshot_output *output); /* @@ -73,7 +74,7 @@ extern int lttng_snapshot_output_set_name(const char *name, * * Return 0 on success or else a negative LTTNG_ERR code. */ -extern int lttng_snapshot_output_set_local_path(const char *path, +LTTNG_EXPORT extern int lttng_snapshot_output_set_local_path(const char *path, struct lttng_snapshot_output *output); /* @@ -84,7 +85,7 @@ extern int lttng_snapshot_output_set_local_path(const char *path, * * Return 0 on success or else a negative LTTNG_ERR code. */ -extern int lttng_snapshot_output_set_network_url(const char *url, +LTTNG_EXPORT extern int lttng_snapshot_output_set_network_url(const char *url, struct lttng_snapshot_output *output); /* @@ -97,15 +98,15 @@ extern int lttng_snapshot_output_set_network_url(const char *url, * * Return 0 on success or else a negative LTTNG_ERR code. */ -extern int lttng_snapshot_output_set_network_urls( +LTTNG_EXPORT extern int lttng_snapshot_output_set_network_urls( const char *ctrl_url, const char *data_url, struct lttng_snapshot_output *output); /* Set the control URL. Local and remote URL are supported. */ -extern int lttng_snapshot_output_set_ctrl_url(const char *url, +LTTNG_EXPORT extern int lttng_snapshot_output_set_ctrl_url(const char *url, struct lttng_snapshot_output *output); /* Set the data URL. Local and remote URL are supported. */ -extern int lttng_snapshot_output_set_data_url(const char *url, +LTTNG_EXPORT extern int lttng_snapshot_output_set_data_url(const char *url, struct lttng_snapshot_output *output); /* @@ -113,7 +114,7 @@ extern int lttng_snapshot_output_set_data_url(const char *url, * * Return 0 on success or else a negative LTTNG_ERR code. */ -extern int lttng_snapshot_add_output(const char *session_name, +LTTNG_EXPORT extern int lttng_snapshot_add_output(const char *session_name, struct lttng_snapshot_output *output); /* @@ -121,7 +122,7 @@ extern int lttng_snapshot_add_output(const char *session_name, * * Return 0 on success or else a negative LTTNG_ERR code. */ -extern int lttng_snapshot_del_output(const char *session_name, +LTTNG_EXPORT extern int lttng_snapshot_del_output(const char *session_name, struct lttng_snapshot_output *output); /* @@ -131,7 +132,7 @@ extern int lttng_snapshot_del_output(const char *session_name, * Return 0 on success or else a negative LTTNG_ERR code and the list pointer * is untouched. */ -extern int lttng_snapshot_list_output(const char *session_name, +LTTNG_EXPORT extern int lttng_snapshot_list_output(const char *session_name, struct lttng_snapshot_output_list **list); /* @@ -141,13 +142,13 @@ extern int lttng_snapshot_list_output(const char *session_name, * Return the next object on success or else NULL indicating the end of the * list. */ -extern struct lttng_snapshot_output *lttng_snapshot_output_list_get_next( +LTTNG_EXPORT extern struct lttng_snapshot_output *lttng_snapshot_output_list_get_next( struct lttng_snapshot_output_list *list); /* * Free an output list object. */ -extern void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list); +LTTNG_EXPORT extern void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list); /* * Snapshot a trace for the given session. @@ -161,7 +162,7 @@ extern void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list * * Return 0 on success or else a negative LTTNG_ERR value. */ -extern int lttng_snapshot_record(const char *session_name, +LTTNG_EXPORT extern int lttng_snapshot_record(const char *session_name, struct lttng_snapshot_output *output, int wait); #ifdef __cplusplus diff --git a/include/lttng/tracker.h b/include/lttng/tracker.h index fa91abab6..869f8a8f8 100644 --- a/include/lttng/tracker.h +++ b/include/lttng/tracker.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -115,7 +116,7 @@ struct lttng_process_attr_values; * The tracker's ownership is transfered to the caller. Use * lttng_process_attr_tracker_handle_destroy() to dispose of it. */ -extern enum lttng_error_code lttng_session_get_tracker_handle( +LTTNG_EXPORT extern enum lttng_error_code lttng_session_get_tracker_handle( const char *session_name, enum lttng_domain_type domain, enum lttng_process_attr process_attr, @@ -124,7 +125,7 @@ extern enum lttng_error_code lttng_session_get_tracker_handle( /* * Destroy a process attribute tracker handle. */ -extern void lttng_process_attr_tracker_handle_destroy( +LTTNG_EXPORT extern void lttng_process_attr_tracker_handle_destroy( struct lttng_process_attr_tracker_handle *tracker_handle); /* @@ -134,7 +135,7 @@ extern void lttng_process_attr_tracker_handle_destroy( * policy of a process attribute tracker on success, * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID on error. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_tracking_policy( const struct lttng_process_attr_tracker_handle *tracker_handle, enum lttng_tracking_policy *policy); @@ -147,7 +148,7 @@ lttng_process_attr_tracker_handle_get_tracking_policy( * Returns the LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success, * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID on error. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_set_tracking_policy( const struct lttng_process_attr_tracker_handle *tracker_handle, enum lttng_tracking_policy policy); @@ -162,7 +163,7 @@ lttng_process_attr_tracker_handle_set_tracking_policy( * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_process_id_tracker_handle_add_pid( const struct lttng_process_attr_tracker_handle *process_id_tracker, @@ -177,7 +178,7 @@ lttng_process_attr_process_id_tracker_handle_add_pid( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_process_id_tracker_handle_remove_pid( const struct lttng_process_attr_tracker_handle *process_id_tracker, @@ -193,7 +194,7 @@ lttng_process_attr_process_id_tracker_handle_remove_pid( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_process_id_tracker_handle_add_pid( const struct lttng_process_attr_tracker_handle *process_id_tracker, @@ -208,7 +209,7 @@ lttng_process_attr_virtual_process_id_tracker_handle_add_pid( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_process_id_tracker_handle_remove_pid( const struct lttng_process_attr_tracker_handle *process_id_tracker, @@ -223,7 +224,7 @@ lttng_process_attr_virtual_process_id_tracker_handle_remove_pid( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_add_uid( const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid); @@ -237,7 +238,7 @@ lttng_process_attr_user_id_tracker_handle_add_uid( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_remove_uid( const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid); @@ -254,7 +255,7 @@ lttng_process_attr_user_id_tracker_handle_remove_uid( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_add_user_name( const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name); @@ -271,7 +272,7 @@ lttng_process_attr_user_id_tracker_handle_add_user_name( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_remove_user_name( const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name); @@ -286,7 +287,7 @@ lttng_process_attr_user_id_tracker_handle_remove_user_name( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_add_uid( const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid); @@ -300,7 +301,7 @@ lttng_process_attr_virtual_user_id_tracker_handle_add_uid( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_remove_uid( const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid); @@ -318,7 +319,7 @@ lttng_process_attr_virtual_user_id_tracker_handle_remove_uid( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_add_user_name( const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *virtual_user_name); @@ -335,7 +336,7 @@ lttng_process_attr_virtual_user_id_tracker_handle_add_user_name( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name( const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *virtual_user_name); @@ -349,7 +350,7 @@ lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_add_gid( const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid); @@ -363,7 +364,7 @@ lttng_process_attr_group_id_tracker_handle_add_gid( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_remove_gid( const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid); @@ -380,7 +381,7 @@ lttng_process_attr_group_id_tracker_handle_remove_gid( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_add_group_name( const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name); @@ -397,7 +398,7 @@ lttng_process_attr_group_id_tracker_handle_add_group_name( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_remove_group_name( const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name); @@ -412,7 +413,7 @@ lttng_process_attr_group_id_tracker_handle_remove_group_name( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_add_gid( const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid); @@ -426,7 +427,7 @@ lttng_process_attr_virtual_group_id_tracker_handle_add_gid( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_remove_gid( const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid); @@ -444,7 +445,7 @@ lttng_process_attr_virtual_group_id_tracker_handle_remove_gid( * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker * argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_add_group_name( const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *virtual_group_name); @@ -461,7 +462,7 @@ lttng_process_attr_virtual_group_id_tracker_handle_add_group_name( * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if * an invalid tracker argument was provided. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name( const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *virtual_group_name); @@ -479,7 +480,7 @@ lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name( * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID if the tracker's policy is * not LTTNG_POLICY_INCLUDE_SET. */ -extern enum lttng_process_attr_tracker_handle_status +LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_inclusion_set( struct lttng_process_attr_tracker_handle *tracker_handle, const struct lttng_process_attr_values **values); @@ -490,7 +491,7 @@ lttng_process_attr_tracker_handle_get_inclusion_set( * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success, * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID if an invalid argument is provided. */ -extern enum lttng_process_attr_values_status +LTTNG_EXPORT extern enum lttng_process_attr_values_status lttng_process_attr_values_get_count( const struct lttng_process_attr_values *values, unsigned int *count); @@ -501,7 +502,7 @@ lttng_process_attr_values_get_count( * Returns a process attribute value type on success, * LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID if an invalid argument is provided. */ -extern enum lttng_process_attr_value_type +LTTNG_EXPORT extern enum lttng_process_attr_value_type lttng_process_attr_values_get_type_at_index( const struct lttng_process_attr_values *values, unsigned int index); @@ -513,7 +514,7 @@ lttng_process_attr_values_get_type_at_index( * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value * is not a process ID. */ -extern enum lttng_process_attr_values_status +LTTNG_EXPORT extern enum lttng_process_attr_values_status lttng_process_attr_values_get_pid_at_index( const struct lttng_process_attr_values *values, unsigned int index, @@ -526,7 +527,7 @@ lttng_process_attr_values_get_pid_at_index( * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value * is not a user ID. */ -extern enum lttng_process_attr_values_status +LTTNG_EXPORT extern enum lttng_process_attr_values_status lttng_process_attr_values_get_uid_at_index( const struct lttng_process_attr_values *values, unsigned int index, @@ -539,7 +540,7 @@ lttng_process_attr_values_get_uid_at_index( * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value * is not a user name. */ -extern enum lttng_process_attr_values_status +LTTNG_EXPORT extern enum lttng_process_attr_values_status lttng_process_attr_values_get_user_name_at_index( const struct lttng_process_attr_values *values, unsigned int index, @@ -552,7 +553,7 @@ lttng_process_attr_values_get_user_name_at_index( * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value * is not a group ID. */ -extern enum lttng_process_attr_values_status +LTTNG_EXPORT extern enum lttng_process_attr_values_status lttng_process_attr_values_get_gid_at_index( const struct lttng_process_attr_values *values, unsigned int index, @@ -565,7 +566,7 @@ lttng_process_attr_values_get_gid_at_index( * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value * is not a group name. */ -extern enum lttng_process_attr_values_status +LTTNG_EXPORT extern enum lttng_process_attr_values_status lttng_process_attr_values_get_group_name_at_index( const struct lttng_process_attr_values *values, unsigned int index, @@ -588,7 +589,7 @@ lttng_process_attr_values_get_group_name_at_index( * * Returns 0 on success, else a negative LTTng error code. */ -extern int lttng_list_tracker_pids(struct lttng_handle *handle, +LTTNG_EXPORT extern int lttng_list_tracker_pids(struct lttng_handle *handle, int *enabled, int32_t **pids, size_t *nr_pids); @@ -610,7 +611,7 @@ extern int lttng_list_tracker_pids(struct lttng_handle *handle, * * Returns 0 on success, else a negative LTTng error code. */ -extern int lttng_track_pid(struct lttng_handle *handle, int pid); +LTTNG_EXPORT extern int lttng_track_pid(struct lttng_handle *handle, int pid); /* * Deprecated: see `lttng_process_attr_process_id_tracker_handle_remove_pid`. @@ -629,7 +630,7 @@ extern int lttng_track_pid(struct lttng_handle *handle, int pid); * * Returns 0 on success, else a negative LTTng error code. */ -extern int lttng_untrack_pid(struct lttng_handle *handle, int pid); +LTTNG_EXPORT extern int lttng_untrack_pid(struct lttng_handle *handle, int pid); #ifdef __cplusplus } diff --git a/include/lttng/trigger/trigger.h b/include/lttng/trigger/trigger.h index 842203ace..0a944a15a 100644 --- a/include/lttng/trigger/trigger.h +++ b/include/lttng/trigger/trigger.h @@ -12,6 +12,7 @@ #include #include #include +#include struct lttng_action; struct lttng_condition; @@ -62,7 +63,7 @@ enum lttng_trigger_status { * Trigger objects must be destroyed using the lttng_trigger_destroy() * function. */ -extern struct lttng_trigger *lttng_trigger_create( +LTTNG_EXPORT extern struct lttng_trigger *lttng_trigger_create( struct lttng_condition *condition, struct lttng_action *action); /* @@ -74,7 +75,7 @@ extern struct lttng_trigger *lttng_trigger_create( * LTTNG_TRIGGER_STATUS_EPERM if not authorized, * LTTNG_TRIGGER_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_trigger_status lttng_trigger_set_owner_uid( +LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_set_owner_uid( struct lttng_trigger *trigger, uid_t uid); /* @@ -84,7 +85,7 @@ extern enum lttng_trigger_status lttng_trigger_set_owner_uid( * LTTNG_TRIGGER_STATUS_UNSET if unset, * LTTNG_TRIGGER_STATUS_INVALID if invalid parameters are passed. */ -extern enum lttng_trigger_status lttng_trigger_get_owner_uid( +LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_owner_uid( const struct lttng_trigger *trigger, uid_t *uid); /* @@ -94,10 +95,10 @@ extern enum lttng_trigger_status lttng_trigger_get_owner_uid( * * Returns a condition on success, NULL on error. */ -extern struct lttng_condition *lttng_trigger_get_condition( +LTTNG_EXPORT extern struct lttng_condition *lttng_trigger_get_condition( struct lttng_trigger *trigger); -extern const struct lttng_condition *lttng_trigger_get_const_condition( +LTTNG_EXPORT extern const struct lttng_condition *lttng_trigger_get_const_condition( const struct lttng_trigger *trigger); /* @@ -107,10 +108,10 @@ extern const struct lttng_condition *lttng_trigger_get_const_condition( * * Returns an action on success, NULL on error. */ -extern struct lttng_action *lttng_trigger_get_action( +LTTNG_EXPORT extern struct lttng_action *lttng_trigger_get_action( struct lttng_trigger *trigger); -extern const struct lttng_action *lttng_trigger_get_const_action( +LTTNG_EXPORT extern const struct lttng_action *lttng_trigger_get_const_action( const struct lttng_trigger *trigger); /* @@ -124,13 +125,13 @@ extern const struct lttng_action *lttng_trigger_get_const_action( * success, LTTNG_TRIGGER_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_TRIGGER_STATUS_UNSET if the trigger is unnamed. */ -extern enum lttng_trigger_status lttng_trigger_get_name( +LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_name( const struct lttng_trigger *trigger, const char **name); /* * Destroy (frees) a trigger object. */ -extern void lttng_trigger_destroy(struct lttng_trigger *trigger); +LTTNG_EXPORT extern void lttng_trigger_destroy(struct lttng_trigger *trigger); /* * Register a trigger to the session daemon with a given name. @@ -140,7 +141,7 @@ extern void lttng_trigger_destroy(struct lttng_trigger *trigger); * * Returns an LTTng status code. */ -extern enum lttng_error_code lttng_register_trigger_with_name( +LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_name( struct lttng_trigger *trigger, const char *name); @@ -154,7 +155,7 @@ extern enum lttng_error_code lttng_register_trigger_with_name( * * Returns an LTTng status code. */ -extern enum lttng_error_code lttng_register_trigger_with_automatic_name( +LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_automatic_name( struct lttng_trigger *trigger); /* @@ -164,7 +165,7 @@ extern enum lttng_error_code lttng_register_trigger_with_automatic_name( * * Return 0 on success, a negative LTTng error code on error. */ -extern int lttng_unregister_trigger(const struct lttng_trigger *trigger); +LTTNG_EXPORT extern int lttng_unregister_trigger(const struct lttng_trigger *trigger); /* * List triggers for the current user. @@ -176,7 +177,7 @@ extern int lttng_unregister_trigger(const struct lttng_trigger *trigger); * * Returns LTTNG_OK on success, else a suitable LTTng error code. */ -extern enum lttng_error_code lttng_list_triggers( +LTTNG_EXPORT extern enum lttng_error_code lttng_list_triggers( struct lttng_triggers **triggers); /* @@ -188,7 +189,7 @@ extern enum lttng_error_code lttng_list_triggers( * * Returns a trigger, or NULL on error. */ -extern const struct lttng_trigger *lttng_triggers_get_at_index( +LTTNG_EXPORT extern const struct lttng_trigger *lttng_triggers_get_at_index( const struct lttng_triggers *triggers, unsigned int index); /* @@ -197,13 +198,13 @@ extern const struct lttng_trigger *lttng_triggers_get_at_index( * Return LTTNG_TRIGGER_STATUS_OK on success, * LTTNG_TRIGGER_STATUS_INVALID when invalid parameters are passed. */ -extern enum lttng_trigger_status lttng_triggers_get_count( +LTTNG_EXPORT extern enum lttng_trigger_status lttng_triggers_get_count( const struct lttng_triggers *triggers, unsigned int *count); /* * Destroy a trigger set. */ -extern void lttng_triggers_destroy(struct lttng_triggers *triggers); +LTTNG_EXPORT extern void lttng_triggers_destroy(struct lttng_triggers *triggers); /* * Deprecated: invocations should be replaced by @@ -216,7 +217,7 @@ extern void lttng_triggers_destroy(struct lttng_triggers *triggers); * Return 0 on success, a negative LTTng error code on error. */ LTTNG_DEPRECATED("Use lttng_register_trigger_with_automatic_name") -extern int lttng_register_trigger(struct lttng_trigger *trigger); +LTTNG_EXPORT extern int lttng_register_trigger(struct lttng_trigger *trigger); #ifdef __cplusplus } diff --git a/include/lttng/userspace-probe.h b/include/lttng/userspace-probe.h index 5a6fa51a0..b6fc13508 100644 --- a/include/lttng/userspace-probe.h +++ b/include/lttng/userspace-probe.h @@ -8,6 +8,8 @@ #ifndef LTTNG_USERSPACE_PROBE_H #define LTTNG_USERSPACE_PROBE_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -28,28 +30,28 @@ enum lttng_userspace_probe_location_lookup_method_type { /* * Get the type of a lookup method. */ -extern enum lttng_userspace_probe_location_lookup_method_type +LTTNG_EXPORT extern enum lttng_userspace_probe_location_lookup_method_type lttng_userspace_probe_location_lookup_method_get_type( const struct lttng_userspace_probe_location_lookup_method *lookup_method); /* * Destroy a lookup method. */ -extern void lttng_userspace_probe_location_lookup_method_destroy( +LTTNG_EXPORT extern void lttng_userspace_probe_location_lookup_method_destroy( struct lttng_userspace_probe_location_lookup_method *lookup_method); /* * Create a tracepoint ELF function lookup method struct. * Return NULL on failure. */ -extern struct lttng_userspace_probe_location_lookup_method * +LTTNG_EXPORT extern struct lttng_userspace_probe_location_lookup_method * lttng_userspace_probe_location_lookup_method_function_elf_create(void); /* * Create a tracepoint SDT tracepoint lookup method struct. * Return NULL on failure. */ -extern struct lttng_userspace_probe_location_lookup_method * +LTTNG_EXPORT extern struct lttng_userspace_probe_location_lookup_method * lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create(void); @@ -76,14 +78,14 @@ enum lttng_userspace_probe_location_type { /* * Get the type of the userspace probe location. */ -extern enum lttng_userspace_probe_location_type +LTTNG_EXPORT extern enum lttng_userspace_probe_location_type lttng_userspace_probe_location_get_type( const struct lttng_userspace_probe_location *location); /* * Destroy the userspace probe location. */ -extern void lttng_userspace_probe_location_destroy( +LTTNG_EXPORT extern void lttng_userspace_probe_location_destroy( struct lttng_userspace_probe_location *location); @@ -101,7 +103,7 @@ enum lttng_userspace_probe_location_function_instrumentation_type { * The ownership of the lookup method is transferred to the created probe * location. */ -extern struct lttng_userspace_probe_location * +LTTNG_EXPORT extern struct lttng_userspace_probe_location * lttng_userspace_probe_location_function_create(const char *binary_path, const char *function_name, struct lttng_userspace_probe_location_lookup_method *lookup_method); @@ -109,26 +111,26 @@ lttng_userspace_probe_location_function_create(const char *binary_path, /* * Get the target binary path of the probe location of the function type. */ -extern const char *lttng_userspace_probe_location_function_get_binary_path( +LTTNG_EXPORT extern const char *lttng_userspace_probe_location_function_get_binary_path( const struct lttng_userspace_probe_location *location); /* * Get the target function type of the probe location of the function type. */ -extern const char *lttng_userspace_probe_location_function_get_function_name( +LTTNG_EXPORT extern const char *lttng_userspace_probe_location_function_get_function_name( const struct lttng_userspace_probe_location *location); /* * Get the FD to the target binary file to the probe location of the function * type. The FD is only valid for the duration of the lifetime of `location`. */ -extern int lttng_userspace_probe_location_function_get_binary_fd( +LTTNG_EXPORT extern int lttng_userspace_probe_location_function_get_binary_fd( const struct lttng_userspace_probe_location *location); /* * Get the instrumentation type of the function probe location. */ -extern enum lttng_userspace_probe_location_function_instrumentation_type +LTTNG_EXPORT extern enum lttng_userspace_probe_location_function_instrumentation_type lttng_userspace_probe_location_function_get_instrumentation_type( const struct lttng_userspace_probe_location *location); @@ -141,7 +143,7 @@ lttng_userspace_probe_location_function_get_instrumentation_type( * LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID if invalid parameters * are provided. */ -extern enum lttng_userspace_probe_location_status +LTTNG_EXPORT extern enum lttng_userspace_probe_location_status lttng_userspace_probe_location_function_set_instrumentation_type( const struct lttng_userspace_probe_location *location, enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type); @@ -152,7 +154,7 @@ lttng_userspace_probe_location_function_set_instrumentation_type( * * The ownership of the lookup method is NOT transferred to the caller. */ -extern const struct lttng_userspace_probe_location_lookup_method * +LTTNG_EXPORT extern const struct lttng_userspace_probe_location_lookup_method * lttng_userspace_probe_location_get_lookup_method( const struct lttng_userspace_probe_location *location); @@ -165,7 +167,7 @@ lttng_userspace_probe_location_get_lookup_method( * The ownership of the lookup method is transferred to the created probe * location. */ -extern struct lttng_userspace_probe_location * +LTTNG_EXPORT extern struct lttng_userspace_probe_location * lttng_userspace_probe_location_tracepoint_create(const char *binary_path, const char *probe_name, const char *provider_name, struct lttng_userspace_probe_location_lookup_method *lookup_method); @@ -173,27 +175,27 @@ lttng_userspace_probe_location_tracepoint_create(const char *binary_path, /* * Get the target binary path of the probe location of the tracepoint type. */ -extern const char *lttng_userspace_probe_location_tracepoint_get_binary_path( +LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_binary_path( const struct lttng_userspace_probe_location *location); /* * Get the target probe name of the probe location of the tracepoint type. */ -extern const char *lttng_userspace_probe_location_tracepoint_get_probe_name( +LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_probe_name( const struct lttng_userspace_probe_location *location); /* * Get the target probe provider name of the probe location of the tracepoint * type. */ -extern const char *lttng_userspace_probe_location_tracepoint_get_provider_name( +LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_provider_name( const struct lttng_userspace_probe_location *location); /* * Get the FD to the target binary file to the probe location of the tracepoint * type. The FD is only valid for the duration of the lifetime of `location`. */ -extern int lttng_userspace_probe_location_tracepoint_get_binary_fd( +LTTNG_EXPORT extern int lttng_userspace_probe_location_tracepoint_get_binary_fd( const struct lttng_userspace_probe_location *location); #ifdef __cplusplus diff --git a/src/bin/lttng-consumerd/lttng-consumerd.h b/src/bin/lttng-consumerd/lttng-consumerd.h index 7621877d3..354f7f3fa 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.h +++ b/src/bin/lttng-consumerd/lttng-consumerd.h @@ -16,9 +16,11 @@ extern int lttng_consumer_ready; extern const char *tracing_group_name; /* - * This function is dlsym-ed from a test, making it have a C linkage name - * makes it easier. + * This function is dlsym-ed from a test, so needs to be exported. Making it + * have a C linkage name makes it easier, as it avoids having to look up a + * mangled name. */ -extern "C" enum lttng_consumer_type lttng_consumer_get_type(); +extern "C" LTTNG_EXPORT +enum lttng_consumer_type lttng_consumer_get_type(); #endif /* _LTTNG_CONSUMERD_H */ diff --git a/src/bin/lttng-sessiond/notification-thread.cpp b/src/bin/lttng-sessiond/notification-thread.cpp index e8a2adec9..867fc7c04 100644 --- a/src/bin/lttng-sessiond/notification-thread.cpp +++ b/src/bin/lttng-sessiond/notification-thread.cpp @@ -36,8 +36,13 @@ #include #include +/* + * Flag used to temporarily pause data consumption from testpoints. + * + * This variable is dlsym-ed from a test, so needs to be exported. + */ +LTTNG_EXPORT int notifier_consumption_paused; -int notifier_consumption_paused; /* * Destroy the thread data previously created by the init function. */ diff --git a/src/bin/lttng-sessiond/ust-sigbus.cpp b/src/bin/lttng-sessiond/ust-sigbus.cpp index 52a7ac270..93a974eb3 100644 --- a/src/bin/lttng-sessiond/ust-sigbus.cpp +++ b/src/bin/lttng-sessiond/ust-sigbus.cpp @@ -7,9 +7,10 @@ #include #include +#include #include "ust-sigbus.h" -DEFINE_LTTNG_UST_SIGBUS_STATE(); +LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); void lttng_ust_handle_sigbus(void *address) { diff --git a/src/common/config/config-session-abi.h b/src/common/config/config-session-abi.h index 75ff303d4..6c903ef7a 100644 --- a/src/common/config/config-session-abi.h +++ b/src/common/config/config-session-abi.h @@ -8,23 +8,25 @@ #ifndef CONFIG_SESSION_INTERNAL_H #define CONFIG_SESSION_INTERNAL_H +#include + extern const char * const config_element_all; -extern const char * const config_element_channel; -extern const char * const config_element_channels; -extern const char * const config_element_domain; -extern const char * const config_element_domains; -extern const char * const config_element_event; -extern const char * const config_element_events; -extern const char * const config_element_context; -extern const char * const config_element_contexts; -extern const char * const config_element_attributes; -extern const char * const config_element_exclusion; -extern const char * const config_element_exclusions; -extern const char * const config_element_function_attributes; -extern const char * const config_element_probe_attributes; -extern const char * const config_element_symbol_name; -extern const char * const config_element_address; -extern const char * const config_element_offset; +LTTNG_EXPORT extern const char * const config_element_channel; +LTTNG_EXPORT extern const char * const config_element_channels; +LTTNG_EXPORT extern const char * const config_element_domain; +LTTNG_EXPORT extern const char * const config_element_domains; +LTTNG_EXPORT extern const char * const config_element_event; +LTTNG_EXPORT extern const char * const config_element_events; +LTTNG_EXPORT extern const char * const config_element_context; +LTTNG_EXPORT extern const char * const config_element_contexts; +LTTNG_EXPORT extern const char * const config_element_attributes; +LTTNG_EXPORT extern const char * const config_element_exclusion; +LTTNG_EXPORT extern const char * const config_element_exclusions; +LTTNG_EXPORT extern const char * const config_element_function_attributes; +LTTNG_EXPORT extern const char * const config_element_probe_attributes; +LTTNG_EXPORT extern const char * const config_element_symbol_name; +LTTNG_EXPORT extern const char * const config_element_address; +LTTNG_EXPORT extern const char * const config_element_offset; extern const char * const config_element_userspace_probe_lookup; extern const char * const config_element_userspace_probe_lookup_function_default; extern const char * const config_element_userspace_probe_lookup_function_elf; @@ -36,49 +38,49 @@ extern const char * const config_element_userspace_probe_tracepoint_attributes; extern const char * const config_element_userspace_probe_tracepoint_location_provider_name; extern const char * const config_element_userspace_probe_tracepoint_location_probe_name; extern const char * const config_element_name; -extern const char * const config_element_enabled; -extern const char * const config_element_overwrite_mode; -extern const char * const config_element_subbuf_size; -extern const char * const config_element_num_subbuf; -extern const char * const config_element_switch_timer_interval; -extern const char * const config_element_read_timer_interval; +LTTNG_EXPORT extern const char * const config_element_enabled; +LTTNG_EXPORT extern const char * const config_element_overwrite_mode; +LTTNG_EXPORT extern const char * const config_element_subbuf_size; +LTTNG_EXPORT extern const char * const config_element_num_subbuf; +LTTNG_EXPORT extern const char * const config_element_switch_timer_interval; +LTTNG_EXPORT extern const char * const config_element_read_timer_interval; extern const char * const config_element_monitor_timer_interval; extern const char * const config_element_blocking_timeout; -extern const char * const config_element_output; -extern const char * const config_element_output_type; -extern const char * const config_element_tracefile_size; -extern const char * const config_element_tracefile_count; -extern const char * const config_element_live_timer_interval; +LTTNG_EXPORT extern const char * const config_element_output; +LTTNG_EXPORT extern const char * const config_element_output_type; +LTTNG_EXPORT extern const char * const config_element_tracefile_size; +LTTNG_EXPORT extern const char * const config_element_tracefile_count; +LTTNG_EXPORT extern const char * const config_element_live_timer_interval; extern const char * const config_element_discarded_events; extern const char * const config_element_lost_packets; -extern const char * const config_element_type; -extern const char * const config_element_buffer_type; -extern const char * const config_element_session; -extern const char * const config_element_sessions; +LTTNG_EXPORT extern const char * const config_element_type; +LTTNG_EXPORT extern const char * const config_element_buffer_type; +LTTNG_EXPORT extern const char * const config_element_session; +LTTNG_EXPORT extern const char * const config_element_sessions; extern const char * const config_element_context_perf; extern const char * const config_element_context_app; extern const char * const config_element_context_app_provider_name; extern const char * const config_element_context_app_ctx_name; -extern const char * const config_element_config; -extern const char * const config_element_started; -extern const char * const config_element_snapshot_mode; -extern const char * const config_element_loglevel; -extern const char * const config_element_loglevel_type; -extern const char * const config_element_filter; +LTTNG_EXPORT extern const char * const config_element_config; +LTTNG_EXPORT extern const char * const config_element_started; +LTTNG_EXPORT extern const char * const config_element_snapshot_mode; +LTTNG_EXPORT extern const char * const config_element_loglevel; +LTTNG_EXPORT extern const char * const config_element_loglevel_type; +LTTNG_EXPORT extern const char * const config_element_filter; extern const char * const config_element_filter_expression; -extern const char * const config_element_snapshot_outputs; -extern const char * const config_element_consumer_output; -extern const char * const config_element_destination; -extern const char * const config_element_path; -extern const char * const config_element_net_output; -extern const char * const config_element_control_uri; -extern const char * const config_element_data_uri; -extern const char * const config_element_max_size; -extern const char * const config_element_pid; +LTTNG_EXPORT extern const char * const config_element_snapshot_outputs; +LTTNG_EXPORT extern const char * const config_element_consumer_output; +LTTNG_EXPORT extern const char * const config_element_destination; +LTTNG_EXPORT extern const char * const config_element_path; +LTTNG_EXPORT extern const char * const config_element_net_output; +LTTNG_EXPORT extern const char * const config_element_control_uri; +LTTNG_EXPORT extern const char * const config_element_data_uri; +LTTNG_EXPORT extern const char * const config_element_max_size; +LTTNG_EXPORT extern const char * const config_element_pid; extern const char * const config_element_process_attr_id; -extern const char * const config_element_pids; -extern const char * const config_element_name; -extern const char * const config_element_shared_memory_path; +LTTNG_EXPORT extern const char * const config_element_pids; +LTTNG_EXPORT extern const char * const config_element_name; +LTTNG_EXPORT extern const char * const config_element_shared_memory_path; extern const char * const config_element_process_attr_tracker_pid; extern const char * const config_element_process_attr_tracker_vpid; extern const char * const config_element_process_attr_tracker_uid; @@ -99,50 +101,50 @@ extern const char * const config_element_rotation_timer_interval; extern const char * const config_element_rotation_size; extern const char * const config_element_rotation_schedule; -extern const char * const config_domain_type_kernel; -extern const char * const config_domain_type_ust; -extern const char * const config_domain_type_jul; -extern const char * const config_domain_type_log4j; -extern const char * const config_domain_type_python; +LTTNG_EXPORT extern const char * const config_domain_type_kernel; +LTTNG_EXPORT extern const char * const config_domain_type_ust; +LTTNG_EXPORT extern const char * const config_domain_type_jul; +LTTNG_EXPORT extern const char * const config_domain_type_log4j; +LTTNG_EXPORT extern const char * const config_domain_type_python; -extern const char * const config_buffer_type_per_pid; -extern const char * const config_buffer_type_per_uid; -extern const char * const config_buffer_type_global; +LTTNG_EXPORT extern const char * const config_buffer_type_per_pid; +LTTNG_EXPORT extern const char * const config_buffer_type_per_uid; +LTTNG_EXPORT extern const char * const config_buffer_type_global; -extern const char * const config_overwrite_mode_discard; -extern const char * const config_overwrite_mode_overwrite; +LTTNG_EXPORT extern const char * const config_overwrite_mode_discard; +LTTNG_EXPORT extern const char * const config_overwrite_mode_overwrite; -extern const char * const config_output_type_splice; -extern const char * const config_output_type_mmap; +LTTNG_EXPORT extern const char * const config_output_type_splice; +LTTNG_EXPORT extern const char * const config_output_type_mmap; -extern const char * const config_loglevel_type_all; -extern const char * const config_loglevel_type_range; -extern const char * const config_loglevel_type_single; +LTTNG_EXPORT extern const char * const config_loglevel_type_all; +LTTNG_EXPORT extern const char * const config_loglevel_type_range; +LTTNG_EXPORT extern const char * const config_loglevel_type_single; -extern const char * const config_event_type_all; -extern const char * const config_event_type_tracepoint; -extern const char * const config_event_type_probe; +LTTNG_EXPORT extern const char * const config_event_type_all; +LTTNG_EXPORT extern const char * const config_event_type_tracepoint; +LTTNG_EXPORT extern const char * const config_event_type_probe; extern const char * const config_event_type_userspace_probe; -extern const char * const config_event_type_function; -extern const char * const config_event_type_function_entry; -extern const char * const config_event_type_noop; -extern const char * const config_event_type_syscall; -extern const char * const config_event_type_kprobe; -extern const char * const config_event_type_kretprobe; +LTTNG_EXPORT extern const char * const config_event_type_function; +LTTNG_EXPORT extern const char * const config_event_type_function_entry; +LTTNG_EXPORT extern const char * const config_event_type_noop; +LTTNG_EXPORT extern const char * const config_event_type_syscall; +LTTNG_EXPORT extern const char * const config_event_type_kprobe; +LTTNG_EXPORT extern const char * const config_event_type_kretprobe; -extern const char * const config_event_context_pid; -extern const char * const config_event_context_procname; -extern const char * const config_event_context_prio; -extern const char * const config_event_context_nice; -extern const char * const config_event_context_vpid; -extern const char * const config_event_context_tid; -extern const char * const config_event_context_vtid; -extern const char * const config_event_context_ppid; -extern const char * const config_event_context_vppid; -extern const char * const config_event_context_pthread_id; -extern const char * const config_event_context_hostname; -extern const char * const config_event_context_ip; -extern const char * const config_event_context_perf_thread_counter; +LTTNG_EXPORT extern const char * const config_event_context_pid; +LTTNG_EXPORT extern const char * const config_event_context_procname; +LTTNG_EXPORT extern const char * const config_event_context_prio; +LTTNG_EXPORT extern const char * const config_event_context_nice; +LTTNG_EXPORT extern const char * const config_event_context_vpid; +LTTNG_EXPORT extern const char * const config_event_context_tid; +LTTNG_EXPORT extern const char * const config_event_context_vtid; +LTTNG_EXPORT extern const char * const config_event_context_ppid; +LTTNG_EXPORT extern const char * const config_event_context_vppid; +LTTNG_EXPORT extern const char * const config_event_context_pthread_id; +LTTNG_EXPORT extern const char * const config_event_context_hostname; +LTTNG_EXPORT extern const char * const config_event_context_ip; +LTTNG_EXPORT extern const char * const config_event_context_perf_thread_counter; extern const char * const config_event_context_app; extern const char * const config_event_context_interruptible; extern const char * const config_event_context_preemptible; diff --git a/src/common/config/session-config.c b/src/common/config/session-config.c index cf785c8b5..08d66851b 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -52,17 +52,17 @@ struct session_config_validation_ctx { }; const char * const config_element_all = "all"; -const char * const config_str_yes = "yes"; -const char * const config_str_true = "true"; -const char * const config_str_on = "on"; -const char * const config_str_no = "no"; -const char * const config_str_false = "false"; -const char * const config_str_off = "off"; -const char * const config_xml_encoding = "UTF-8"; -const size_t config_xml_encoding_bytes_per_char = 2; /* Size of the encoding's largest character */ -const char * const config_xml_indent_string = "\t"; -const char * const config_xml_true = "true"; -const char * const config_xml_false = "false"; +LTTNG_EXPORT const char * const config_str_yes = "yes"; +LTTNG_EXPORT const char * const config_str_true = "true"; +LTTNG_EXPORT const char * const config_str_on = "on"; +LTTNG_EXPORT const char * const config_str_no = "no"; +LTTNG_EXPORT const char * const config_str_false = "false"; +LTTNG_EXPORT const char * const config_str_off = "off"; +LTTNG_EXPORT const char * const config_xml_encoding = "UTF-8"; +LTTNG_EXPORT const size_t config_xml_encoding_bytes_per_char = 2; /* Size of the encoding's largest character */ +LTTNG_EXPORT const char * const config_xml_indent_string = "\t"; +LTTNG_EXPORT const char * const config_xml_true = "true"; +LTTNG_EXPORT const char * const config_xml_false = "false"; const char * const config_element_channel = "channel"; const char * const config_element_channels = "channels"; @@ -239,7 +239,7 @@ const char * const config_event_context_vegid = "VEGID"; const char * const config_event_context_vsgid = "VSGID"; /* Deprecated symbols */ -const char * const config_element_perf; +LTTNG_EXPORT const char * const config_element_perf; enum process_event_node_phase { CREATION = 0, diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 6f2aae31b..1b0ee000b 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -859,8 +859,12 @@ extern int consumer_quit; */ extern int consumer_quit; -/* Flag used to temporarily pause data consumption from testpoints. */ -extern int data_consumption_paused; +/* + * Flag used to temporarily pause data consumption from testpoints. + * + * This variable is dlsym-ed from a test, so needs to be exported. + */ +LTTNG_EXPORT extern int data_consumption_paused; /* Return a human-readable consumer type string that is suitable for logging. */ static inline diff --git a/src/common/error.h b/src/common/error.h index 6660cee6a..8bb0de15c 100644 --- a/src/common/error.h +++ b/src/common/error.h @@ -47,7 +47,7 @@ struct log_time { /* Format: 00:00:00.000000000 plus NULL byte. */ char str[19]; }; -extern DECLARE_URCU_TLS(struct log_time, error_log_time); +extern LTTNG_EXPORT DECLARE_URCU_TLS(struct log_time, error_log_time); extern DECLARE_URCU_TLS(const char *, logger_thread_name); extern int lttng_opt_quiet; diff --git a/src/common/filter/filter-lexer.l b/src/common/filter/filter-lexer.l index cdb099af7..9da4645e5 100644 --- a/src/common/filter/filter-lexer.l +++ b/src/common/filter/filter-lexer.l @@ -13,6 +13,7 @@ #include #include "filter-ast.h" #include "filter-parser.h" +#include static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) __attribute__((unused)); @@ -127,3 +128,215 @@ L\" BEGIN(string_lit); return STRING_LITERAL_START; [ \t\n]+ ; /* ignore */ . return ERROR; %% + +/* + * The lexer symbols were (e.g. lttng_yy_create_buffer) were mistakenly + * exported in the past, so must stay exported. Since it is difficult to tweak + * how the lexer functions are emitted, the strategy used here was to use a + * different prefix for the symbols (`lttng_filter_`) and define aliases with + * the old prefix (`lttng_`). + * + * The `MAKE_ALIAS` macro defines one such alias. + */ +LTTNG_EXPORT +YY_BUFFER_STATE lttng_yy_create_buffer(FILE *file, int size, yyscan_t yyscanner); +YY_BUFFER_STATE lttng_yy_create_buffer(FILE *file, int size, yyscan_t yyscanner) +{ + return yy_create_buffer(file, size, yyscanner); +} + +LTTNG_EXPORT +void lttng_yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); +void lttng_yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) +{ + return yy_delete_buffer(b, yyscanner); +} + +LTTNG_EXPORT +void lttng_yy_flush_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner); +void lttng_yy_flush_buffer (YY_BUFFER_STATE b, yyscan_t yyscanner) +{ + return yy_flush_buffer(b, yyscanner); +} + +LTTNG_EXPORT +YY_BUFFER_STATE lttng_yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner); +YY_BUFFER_STATE lttng_yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner) +{ + return yy_scan_buffer(base, size, yyscanner); +} + +LTTNG_EXPORT +YY_BUFFER_STATE lttng_yy_scan_bytes(const char *bytes, int len, yyscan_t yyscanner); +YY_BUFFER_STATE lttng_yy_scan_bytes(const char *bytes, int len, yyscan_t yyscanner) +{ + return yy_scan_bytes(bytes, len, yyscanner); +} + +LTTNG_EXPORT +YY_BUFFER_STATE lttng_yy_scan_string(const char *yy_str, yyscan_t yyscanner); +YY_BUFFER_STATE lttng_yy_scan_string(const char *yy_str, yyscan_t yyscanner) +{ + return yy_scan_string(yy_str, yyscanner); +} + +LTTNG_EXPORT +void lttng_yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); +void lttng_yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) +{ + return yy_switch_to_buffer(new_buffer, yyscanner); +} + +LTTNG_EXPORT +void *lttng_yyalloc(yy_size_t s, yyscan_t yyscanner); +void *lttng_yyalloc(yy_size_t s, yyscan_t yyscanner) +{ + return yyalloc(s, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyfree(void *p, yyscan_t yyscanner); +void lttng_yyfree(void *p, yyscan_t yyscanner) +{ + return yyfree(p, yyscanner); +} + +LTTNG_EXPORT +int lttng_yyget_column(yyscan_t yyscanner); +int lttng_yyget_column(yyscan_t yyscanner) +{ + return yyget_column(yyscanner); +} + +LTTNG_EXPORT +int lttng_yyget_debug(yyscan_t yyscanner); +int lttng_yyget_debug(yyscan_t yyscanner) +{ + return yyget_debug(yyscanner); +} + +LTTNG_EXPORT +YY_EXTRA_TYPE lttng_yyget_extra(yyscan_t yyscanner); +YY_EXTRA_TYPE lttng_yyget_extra(yyscan_t yyscanner) +{ + return yyget_extra(yyscanner); +} + +LTTNG_EXPORT +FILE *lttng_yyget_in(yyscan_t yyscanner); +FILE *lttng_yyget_in(yyscan_t yyscanner) +{ + return yyget_in(yyscanner); +} + +LTTNG_EXPORT +int lttng_yyget_leng(yyscan_t yyscanner); +int lttng_yyget_leng(yyscan_t yyscanner) +{ + return yyget_leng(yyscanner); +} + +LTTNG_EXPORT +int lttng_yyget_lineno(yyscan_t yyscanner); +int lttng_yyget_lineno(yyscan_t yyscanner) +{ + return yyget_lineno(yyscanner); +} + +LTTNG_EXPORT +YYSTYPE *lttng_yyget_lval(yyscan_t yyscanner); +YYSTYPE *lttng_yyget_lval(yyscan_t yyscanner) +{ + return yyget_lval(yyscanner); +} + +LTTNG_EXPORT +FILE *lttng_yyget_out(yyscan_t yyscanner); +FILE *lttng_yyget_out(yyscan_t yyscanner) +{ + return yyget_out(yyscanner); +} + +LTTNG_EXPORT +char *lttng_yyget_text(yyscan_t yyscanner); +char *lttng_yyget_text(yyscan_t yyscanner) +{ + return yyget_text(yyscanner); +} + +LTTNG_EXPORT +int lttng_yylex_init(yyscan_t *scanner); +int lttng_yylex_init(yyscan_t *scanner) +{ + return yylex_init(scanner); +} + +LTTNG_EXPORT +void lttng_yypop_buffer_state(yyscan_t yyscanner); +void lttng_yypop_buffer_state(yyscan_t yyscanner) +{ + return yypop_buffer_state(yyscanner); +} + +LTTNG_EXPORT +void lttng_yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); +void lttng_yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) +{ + return yypush_buffer_state(new_buffer, yyscanner); +} + +LTTNG_EXPORT +void *lttng_yyrealloc(void *p, yy_size_t s, yyscan_t yyscanner); +void *lttng_yyrealloc(void *p, yy_size_t s, yyscan_t yyscanner) +{ + return yyrealloc(p, s, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_column(int _column_no, yyscan_t yyscanner); +void lttng_yyset_column(int _column_no, yyscan_t yyscanner) +{ + return yyset_column(_column_no, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_debug(int debug_flag, yyscan_t yyscanner); +void lttng_yyset_debug(int debug_flag, yyscan_t yyscanner) +{ + return yyset_debug(debug_flag, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner); +void lttng_yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner) +{ + return yyset_extra(user_defined, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_in(FILE *_in_str, yyscan_t yyscanner); +void lttng_yyset_in(FILE *_in_str, yyscan_t yyscanner) +{ + return yyset_in(_in_str, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_lineno(int _line_number, yyscan_t yyscanner); +void lttng_yyset_lineno(int _line_number, yyscan_t yyscanner) +{ + return yyset_lineno(_line_number, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner); +void lttng_yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner) +{ + return yyset_lval(yylval_param, yyscanner); +} + +LTTNG_EXPORT +void lttng_yyset_out(FILE *_out_str, yyscan_t yyscanner); +void lttng_yyset_out(FILE *_out_str, yyscan_t yyscanner) +{ + return yyset_out(_out_str, yyscanner); +} diff --git a/src/common/filter/filter-symbols.h b/src/common/filter/filter-symbols.h index 031776da0..27aaada54 100644 --- a/src/common/filter/filter-symbols.h +++ b/src/common/filter/filter-symbols.h @@ -12,34 +12,34 @@ * */ -#define yy_create_buffer lttng_yy_create_buffer -#define yy_delete_buffer lttng_yy_delete_buffer -#define yy_flush_buffer lttng_yy_flush_buffer -#define yy_scan_buffer lttng_yy_scan_buffer -#define yy_scan_bytes lttng_yy_scan_bytes -#define yy_scan_string lttng_yy_scan_string -#define yy_switch_to_buffer lttng_yy_switch_to_buffer -#define yyalloc lttng_yyalloc -#define yyfree lttng_yyfree -#define yyget_column lttng_yyget_column -#define yyget_debug lttng_yyget_debug -#define yyget_extra lttng_yyget_extra -#define yyget_in lttng_yyget_in -#define yyget_leng lttng_yyget_leng -#define yyget_lineno lttng_yyget_lineno -#define yyget_lval lttng_yyget_lval -#define yyget_out lttng_yyget_out -#define yyget_text lttng_yyget_text -#define yylex_init lttng_yylex_init -#define yypop_buffer_state lttng_yypop_buffer_state -#define yypush_buffer_state lttng_yypush_buffer_state -#define yyrealloc lttng_yyrealloc -#define yyset_column lttng_yyset_column -#define yyset_debug lttng_yyset_debug -#define yyset_extra lttng_yyset_extra -#define yyset_in lttng_yyset_in -#define yyset_lineno lttng_yyset_lineno -#define yyset_lval lttng_yyset_lval -#define yyset_out lttng_yyset_out +#define yy_create_buffer lttng_filter_yy_create_buffer +#define yy_delete_buffer lttng_filter_yy_delete_buffer +#define yy_flush_buffer lttng_filter_yy_flush_buffer +#define yy_scan_buffer lttng_filter_yy_scan_buffer +#define yy_scan_bytes lttng_filter_yy_scan_bytes +#define yy_scan_string lttng_filter_yy_scan_string +#define yy_switch_to_buffer lttng_filter_yy_switch_to_buffer +#define yyalloc lttng_filter_yyalloc +#define yyfree lttng_filter_yyfree +#define yyget_column lttng_filter_yyget_column +#define yyget_debug lttng_filter_yyget_debug +#define yyget_extra lttng_filter_yyget_extra +#define yyget_in lttng_filter_yyget_in +#define yyget_leng lttng_filter_yyget_leng +#define yyget_lineno lttng_filter_yyget_lineno +#define yyget_lval lttng_filter_yyget_lval +#define yyget_out lttng_filter_yyget_out +#define yyget_text lttng_filter_yyget_text +#define yylex_init lttng_filter_yylex_init +#define yypop_buffer_state lttng_filter_yypop_buffer_state +#define yypush_buffer_state lttng_filter_yypush_buffer_state +#define yyrealloc lttng_filter_yyrealloc +#define yyset_column lttng_filter_yyset_column +#define yyset_debug lttng_filter_yyset_debug +#define yyset_extra lttng_filter_yyset_extra +#define yyset_in lttng_filter_yyset_in +#define yyset_lineno lttng_filter_yyset_lineno +#define yyset_lval lttng_filter_yyset_lval +#define yyset_out lttng_filter_yyset_out #endif /* _FILTER_SYMBOLS_H */ diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index e2dae968d..cefd43833 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -12,13 +12,14 @@ #include #include +#include #include #ifdef __cplusplus extern "C" { #endif -extern unsigned long lttng_ht_seed; +LTTNG_EXPORT extern unsigned long lttng_ht_seed; typedef unsigned long (*hash_fct_type)(const void *_key, unsigned long seed); typedef cds_lfht_match_fct hash_match_fct; diff --git a/src/common/index-allocator.h b/src/common/index-allocator.h index 9dbd745e6..93ab5ddd5 100644 --- a/src/common/index-allocator.h +++ b/src/common/index-allocator.h @@ -9,6 +9,7 @@ #define _COMMON_INDEX_ALLOCATOR_H #include +#include #ifdef __cplusplus extern "C" { @@ -25,19 +26,19 @@ enum lttng_index_allocator_status { /* * Create an index allocator of `index_count` slots. */ -struct lttng_index_allocator *lttng_index_allocator_create( +LTTNG_EXPORT struct lttng_index_allocator *lttng_index_allocator_create( uint64_t index_count); /* * Get the number of indexes currently in use. */ -uint64_t lttng_index_allocator_get_index_count( +LTTNG_EXPORT uint64_t lttng_index_allocator_get_index_count( struct lttng_index_allocator *allocator); /* * Allocate (i.e. reserve) a slot. */ -enum lttng_index_allocator_status lttng_index_allocator_alloc( +LTTNG_EXPORT enum lttng_index_allocator_status lttng_index_allocator_alloc( struct lttng_index_allocator *allocator, uint64_t *index); @@ -45,13 +46,13 @@ enum lttng_index_allocator_status lttng_index_allocator_alloc( * Release a slot by index. The slot will be re-used by the index allocator * in future 'alloc' calls. */ -enum lttng_index_allocator_status lttng_index_allocator_release( +LTTNG_EXPORT enum lttng_index_allocator_status lttng_index_allocator_release( struct lttng_index_allocator *allocator, uint64_t index); /* * Destroy an index allocator. */ -void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator); +LTTNG_EXPORT void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator); #ifdef __cplusplus } diff --git a/src/common/lttng-elf.h b/src/common/lttng-elf.h index 49b064ce5..524b87846 100644 --- a/src/common/lttng-elf.h +++ b/src/common/lttng-elf.h @@ -8,9 +8,11 @@ * */ -int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset); +#include -int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name, +LTTNG_EXPORT int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset); + +LTTNG_EXPORT int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name, const char *probe_name, uint64_t **offsets, uint32_t *nb_probe); #endif /* _LTTNG_ELF_H */ diff --git a/src/common/mi-lttng.c b/src/common/mi-lttng.c index b790f793a..1ff9f936c 100644 --- a/src/common/mi-lttng.c +++ b/src/common/mi-lttng.c @@ -435,14 +435,14 @@ const char *const mi_lttng_element_error_query_results = const char * const mi_lttng_element_context_symbol = "symbol"; /* Deprecated symbols preserved for ABI compatibility. */ -const char * const mi_lttng_context_type_perf_counter; -const char * const mi_lttng_context_type_perf_cpu_counter; -const char * const mi_lttng_context_type_perf_thread_counter; -const char * const mi_lttng_element_track_untrack_pid_target; -const char * const mi_lttng_element_track_untrack_targets; -const char * const mi_lttng_element_calibrate; -const char * const mi_lttng_element_calibrate_function; -const char * const mi_lttng_element_command_calibrate; +LTTNG_EXPORT const char * const mi_lttng_context_type_perf_counter; +LTTNG_EXPORT const char * const mi_lttng_context_type_perf_cpu_counter; +LTTNG_EXPORT const char * const mi_lttng_context_type_perf_thread_counter; +LTTNG_EXPORT const char * const mi_lttng_element_track_untrack_pid_target; +LTTNG_EXPORT const char * const mi_lttng_element_track_untrack_targets; +LTTNG_EXPORT const char * const mi_lttng_element_calibrate; +LTTNG_EXPORT const char * const mi_lttng_element_calibrate_function; +LTTNG_EXPORT const char * const mi_lttng_element_command_calibrate; /* This is a merge of jul loglevel and regular loglevel * Those should never overlap by definition diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index 2f27bf6cd..74ae502f5 100644 --- a/src/common/mi-lttng.h +++ b/src/common/mi-lttng.h @@ -62,147 +62,147 @@ struct mi_lttng_error_query_callbacks { }; /* Strings related to command */ -extern const char * const mi_lttng_element_command; -extern const char * const mi_lttng_element_command_action; -extern const char * const mi_lttng_element_command_add_context; +LTTNG_EXPORT extern const char * const mi_lttng_element_command; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_action; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_add_context; extern const char * const mi_lttng_element_command_add_trigger; -extern const char * const mi_lttng_element_command_create; -extern const char * const mi_lttng_element_command_destroy; -extern const char * const mi_lttng_element_command_disable_channel; -extern const char * const mi_lttng_element_command_disable_event; -extern const char * const mi_lttng_element_command_enable_channels; -extern const char * const mi_lttng_element_command_enable_event; -extern const char * const mi_lttng_element_command_list; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_create; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_destroy; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_disable_channel; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_disable_event; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_enable_channels; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_enable_event; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_list; extern const char * const mi_lttng_element_command_list_trigger; -extern const char * const mi_lttng_element_command_load; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_load; extern const char * const mi_lttng_element_command_metadata; extern const char * const mi_lttng_element_command_metadata_action; extern const char * const mi_lttng_element_command_regenerate; extern const char * const mi_lttng_element_command_regenerate_action; -extern const char * const mi_lttng_element_command_name; -extern const char * const mi_lttng_element_command_output; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_name; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_output; extern const char * const mi_lttng_element_command_remove_trigger; -extern const char * const mi_lttng_element_command_save; -extern const char * const mi_lttng_element_command_set_session; -extern const char * const mi_lttng_element_command_snapshot; -extern const char * const mi_lttng_element_command_snapshot_add; -extern const char * const mi_lttng_element_command_snapshot_del; -extern const char * const mi_lttng_element_command_snapshot_list; -extern const char * const mi_lttng_element_command_snapshot_record; -extern const char * const mi_lttng_element_command_start; -extern const char * const mi_lttng_element_command_stop; -extern const char * const mi_lttng_element_command_success; -extern const char * const mi_lttng_element_command_track; -extern const char * const mi_lttng_element_command_untrack; -extern const char * const mi_lttng_element_command_version; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_save; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_set_session; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_add; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_del; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_list; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_record; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_start; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_stop; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_success; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_track; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_untrack; +LTTNG_EXPORT extern const char * const mi_lttng_element_command_version; extern const char * const mi_lttng_element_command_rotate; extern const char * const mi_lttng_element_command_enable_rotation; extern const char * const mi_lttng_element_command_disable_rotation; extern const char * const mi_lttng_element_command_clear; /* Strings related to version command */ -extern const char * const mi_lttng_element_version; -extern const char * const mi_lttng_element_version_commit; -extern const char * const mi_lttng_element_version_description; -extern const char * const mi_lttng_element_version_license; -extern const char * const mi_lttng_element_version_major; -extern const char * const mi_lttng_element_version_minor; -extern const char * const mi_lttng_element_version_patch_level; -extern const char * const mi_lttng_element_version_str; -extern const char * const mi_lttng_element_version_web; +LTTNG_EXPORT extern const char * const mi_lttng_element_version; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_commit; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_description; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_license; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_major; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_minor; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_patch_level; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_str; +LTTNG_EXPORT extern const char * const mi_lttng_element_version_web; /* String related to a lttng_event_field */ -extern const char * const mi_lttng_element_event_field; -extern const char * const mi_lttng_element_event_fields; +LTTNG_EXPORT extern const char * const mi_lttng_element_event_field; +LTTNG_EXPORT extern const char * const mi_lttng_element_event_fields; /* String related to lttng_event_perf_counter_ctx */ -extern const char * const mi_lttng_element_perf_counter_context; +LTTNG_EXPORT extern const char * const mi_lttng_element_perf_counter_context; /* Strings related to pid */ -extern const char * const mi_lttng_element_pid_id; +LTTNG_EXPORT extern const char * const mi_lttng_element_pid_id; /* Strings related to save command */ -extern const char * const mi_lttng_element_save; +LTTNG_EXPORT extern const char * const mi_lttng_element_save; /* Strings related to load command */ -extern const char * const mi_lttng_element_load; +LTTNG_EXPORT extern const char * const mi_lttng_element_load; extern const char * const mi_lttng_element_load_overrides; extern const char * const mi_lttng_element_load_override_url; /* General element of mi_lttng */ -extern const char * const mi_lttng_element_empty; -extern const char * const mi_lttng_element_id; -extern const char * const mi_lttng_element_nowrite; -extern const char * const mi_lttng_element_success; -extern const char * const mi_lttng_element_type_enum; -extern const char * const mi_lttng_element_type_float; -extern const char * const mi_lttng_element_type_integer; -extern const char * const mi_lttng_element_type_other; -extern const char * const mi_lttng_element_type_string; +LTTNG_EXPORT extern const char * const mi_lttng_element_empty; +LTTNG_EXPORT extern const char * const mi_lttng_element_id; +LTTNG_EXPORT extern const char * const mi_lttng_element_nowrite; +LTTNG_EXPORT extern const char * const mi_lttng_element_success; +LTTNG_EXPORT extern const char * const mi_lttng_element_type_enum; +LTTNG_EXPORT extern const char * const mi_lttng_element_type_float; +LTTNG_EXPORT extern const char * const mi_lttng_element_type_integer; +LTTNG_EXPORT extern const char * const mi_lttng_element_type_other; +LTTNG_EXPORT extern const char * const mi_lttng_element_type_string; /* String related to loglevel */ -extern const char * const mi_lttng_loglevel_str_alert; -extern const char * const mi_lttng_loglevel_str_crit; -extern const char * const mi_lttng_loglevel_str_debug; -extern const char * const mi_lttng_loglevel_str_debug_function; -extern const char * const mi_lttng_loglevel_str_debug_line; -extern const char * const mi_lttng_loglevel_str_debug_module; -extern const char * const mi_lttng_loglevel_str_debug_process; -extern const char * const mi_lttng_loglevel_str_debug_program; -extern const char * const mi_lttng_loglevel_str_debug_system; -extern const char * const mi_lttng_loglevel_str_debug_unit; -extern const char * const mi_lttng_loglevel_str_emerg; -extern const char * const mi_lttng_loglevel_str_err; -extern const char * const mi_lttng_loglevel_str_info; -extern const char * const mi_lttng_loglevel_str_notice; -extern const char * const mi_lttng_loglevel_str_unknown; -extern const char * const mi_lttng_loglevel_str_warning; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_alert; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_crit; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_function; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_line; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_module; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_process; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_program; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_system; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_unit; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_emerg; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_err; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_info; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_notice; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_unknown; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_warning; /* String related to loglevel JUL */ -extern const char * const mi_lttng_loglevel_str_jul_all; -extern const char * const mi_lttng_loglevel_str_jul_config; -extern const char * const mi_lttng_loglevel_str_jul_fine; -extern const char * const mi_lttng_loglevel_str_jul_finer; -extern const char * const mi_lttng_loglevel_str_jul_finest; -extern const char * const mi_lttng_loglevel_str_jul_info; -extern const char * const mi_lttng_loglevel_str_jul_off; -extern const char * const mi_lttng_loglevel_str_jul_severe; -extern const char * const mi_lttng_loglevel_str_jul_warning; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_all; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_config; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_fine; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_finer; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_finest; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_info; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_off; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_severe; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_warning; /* String related to loglevel Log4j */ -extern const char * const mi_lttng_loglevel_str_log4j_off; -extern const char * const mi_lttng_loglevel_str_log4j_fatal; -extern const char * const mi_lttng_loglevel_str_log4j_error; -extern const char * const mi_lttng_loglevel_str_log4j_warn; -extern const char * const mi_lttng_loglevel_str_log4j_info; -extern const char * const mi_lttng_loglevel_str_log4j_debug; -extern const char * const mi_lttng_loglevel_str_log4j_trace; -extern const char * const mi_lttng_loglevel_str_log4j_all; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_off; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_fatal; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_error; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_warn; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_info; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_debug; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_trace; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_all; /* String related to loglevel Python */ -extern const char * const mi_lttng_loglevel_str_python_critical; -extern const char * const mi_lttng_loglevel_str_python_error; -extern const char * const mi_lttng_loglevel_str_python_warning; -extern const char * const mi_lttng_loglevel_str_python_info; -extern const char * const mi_lttng_loglevel_str_python_debug; -extern const char * const mi_lttng_loglevel_str_python_notset; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_critical; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_error; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_warning; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_info; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_debug; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_notset; /* String related to loglevel type */ -extern const char * const mi_lttng_loglevel_type_all; -extern const char * const mi_lttng_loglevel_type_range; -extern const char * const mi_lttng_loglevel_type_single; -extern const char * const mi_lttng_loglevel_type_unknown; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_all; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_range; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_single; +LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_unknown; /* String related to a lttng_snapshot */ -extern const char * const mi_lttng_element_snapshot_ctrl_url; -extern const char * const mi_lttng_element_snapshot_data_url; -extern const char * const mi_lttng_element_snapshot_max_size; -extern const char * const mi_lttng_element_snapshot_n_ptr; -extern const char * const mi_lttng_element_snapshot_session_name; -extern const char * const mi_lttng_element_snapshots; +LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_ctrl_url; +LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_data_url; +LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_max_size; +LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_n_ptr; +LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_session_name; +LTTNG_EXPORT extern const char * const mi_lttng_element_snapshots; /* String related to track/untrack command */ -extern const char * const mi_lttng_element_track_untrack_all_wildcard; +LTTNG_EXPORT extern const char * const mi_lttng_element_track_untrack_all_wildcard; extern const char * const mi_lttng_element_session_name; diff --git a/src/common/sessiond-comm/inet.h b/src/common/sessiond-comm/inet.h index 5c0828b2b..9aec36cf1 100644 --- a/src/common/sessiond-comm/inet.h +++ b/src/common/sessiond-comm/inet.h @@ -34,7 +34,7 @@ extern "C" { * Maximum timeout value in seconds of a TCP connection for both send/recv and * connect operations. */ -extern unsigned long lttcomm_inet_tcp_timeout; +LTTNG_EXPORT extern unsigned long lttcomm_inet_tcp_timeout; /* Stub */ struct lttcomm_sock; diff --git a/src/common/spawn-viewer.h b/src/common/spawn-viewer.h index 316fe1998..dc7b7bbcb 100644 --- a/src/common/spawn-viewer.h +++ b/src/common/spawn-viewer.h @@ -8,6 +8,7 @@ * */ +#include #include #if defined(__cplusplus) @@ -24,7 +25,7 @@ extern "C" { * This symbol was mistakenly made public before the 2.12 release. It can't * be removed (but it can be stubbed-out if necessary). */ -int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode); +LTTNG_EXPORT int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode); #if defined(__cplusplus) } diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 31effcc23..310b670b1 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -47,7 +47,7 @@ extern struct lttng_consumer_global_data the_consumer_data; extern int consumer_poll_timeout; -DEFINE_LTTNG_UST_SIGBUS_STATE(); +LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); /* * Free channel object and all streams associated with it. This MUST be used diff --git a/src/lib/lttng-ctl/Makefile.am b/src/lib/lttng-ctl/Makefile.am index e1ffd6a48..b31e5bd6f 100644 --- a/src/lib/lttng-ctl/Makefile.am +++ b/src/lib/lttng-ctl/Makefile.am @@ -6,10 +6,20 @@ AM_CPPFLAGS += -I$(srcdir) -I$(builddir) lib_LTLIBRARIES = liblttng-ctl.la -liblttng_ctl_la_SOURCES = lttng-ctl.c snapshot.c lttng-ctl-helper.h \ - lttng-ctl-health.c save.c load.c deprecated-symbols.c \ - channel.c rotate.c event.c destruction-handle.c clear.c \ - tracker.c +liblttng_ctl_la_SOURCES = \ + channel.cpp \ + clear.cpp \ + deprecated-symbols.cpp \ + destruction-handle.cpp \ + event.cpp \ + load.cpp \ + lttng-ctl.cpp \ + lttng-ctl-health.cpp \ + lttng-ctl-helper.h \ + rotate.cpp \ + save.cpp \ + snapshot.cpp \ + tracker.cpp liblttng_ctl_la_LDFLAGS = \ $(LT_NO_UNDEFINED) \ diff --git a/src/lib/lttng-ctl/channel.c b/src/lib/lttng-ctl/channel.cpp similarity index 98% rename from src/lib/lttng-ctl/channel.c rename to src/lib/lttng-ctl/channel.cpp index 17f9537ba..e7b044ac0 100644 --- a/src/lib/lttng-ctl/channel.c +++ b/src/lib/lttng-ctl/channel.cpp @@ -143,12 +143,12 @@ struct lttng_notification_channel *lttng_notification_channel_create( goto end; } - sock_path = zmalloc(LTTNG_PATH_MAX); + sock_path = (char *) zmalloc(LTTNG_PATH_MAX); if (!sock_path) { goto end; } - channel = zmalloc(sizeof(struct lttng_notification_channel)); + channel = (lttng_notification_channel *) zmalloc(sizeof(struct lttng_notification_channel)); if (!channel) { goto end; } @@ -343,7 +343,7 @@ int enqueue_dropped_notification( goto end; } - pending_notification = zmalloc(sizeof(*pending_notification)); + pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification)); if (!pending_notification) { ret = -1; goto end; @@ -371,7 +371,7 @@ int enqueue_notification_from_current_message( goto end; } - pending_notification = zmalloc(sizeof(*pending_notification)); + pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification)); if (!pending_notification) { ret = -1; goto error; diff --git a/src/lib/lttng-ctl/clear.c b/src/lib/lttng-ctl/clear.cpp similarity index 97% rename from src/lib/lttng-ctl/clear.c rename to src/lib/lttng-ctl/clear.cpp index 3face64de..0eaf97364 100644 --- a/src/lib/lttng-ctl/clear.c +++ b/src/lib/lttng-ctl/clear.cpp @@ -7,6 +7,7 @@ */ #define _LGPL_SOURCE +#include #include #include @@ -63,7 +64,7 @@ static struct lttng_clear_handle *lttng_clear_handle_create(int sessiond_socket) { int ret; - struct lttng_clear_handle *handle = zmalloc(sizeof(*handle)); + struct lttng_clear_handle *handle = (lttng_clear_handle *) zmalloc(sizeof(*handle)); if (!handle) { goto end; @@ -243,8 +244,8 @@ extern enum lttng_clear_handle_status } DBG("%lums elapsed while waiting for session clear completion", diff_ms); - diff_ms = max_t(unsigned long, diff_ms, 1); - diff_ms = min_t(unsigned long, diff_ms, time_left_ms); + diff_ms = std::max(diff_ms, 1UL); + diff_ms = std::min(diff_ms, time_left_ms); time_left_ms -= diff_ms; } diff --git a/src/lib/lttng-ctl/deprecated-symbols.c b/src/lib/lttng-ctl/deprecated-symbols.c deleted file mode 100644 index 0ea802c5e..000000000 --- a/src/lib/lttng-ctl/deprecated-symbols.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2016 Jérémie Galarneau - * - * SPDX-License-Identifier: LGPL-2.1-only - * - */ - -#include - -/* - * These are symbols that were erroneously exposed and have since been removed. - */ - -size_t default_channel_subbuf_size; -size_t default_kernel_channel_subbuf_size; -size_t default_metadata_subbuf_size; -size_t default_ust_pid_channel_subbuf_size; -size_t default_ust_uid_channel_subbuf_size; - -const char * const config_element_pid_tracker; -const char * const config_element_target_pid; -const char * const config_element_targets; -const char * const config_element_trackers; diff --git a/src/lib/lttng-ctl/deprecated-symbols.cpp b/src/lib/lttng-ctl/deprecated-symbols.cpp new file mode 100644 index 000000000..0eaf507c2 --- /dev/null +++ b/src/lib/lttng-ctl/deprecated-symbols.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2016 Jérémie Galarneau + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#include +#include + +/* + * These are symbols that were erroneously exposed and have since been removed. + */ + +LTTNG_EXPORT size_t default_channel_subbuf_size; +LTTNG_EXPORT size_t default_kernel_channel_subbuf_size; +LTTNG_EXPORT size_t default_metadata_subbuf_size; +LTTNG_EXPORT size_t default_ust_pid_channel_subbuf_size; +LTTNG_EXPORT size_t default_ust_uid_channel_subbuf_size; + +LTTNG_EXPORT const char *config_element_pid_tracker = nullptr; +LTTNG_EXPORT const char *config_element_target_pid = nullptr; +LTTNG_EXPORT const char *config_element_targets = nullptr; +LTTNG_EXPORT const char *config_element_trackers = nullptr; diff --git a/src/lib/lttng-ctl/destruction-handle.c b/src/lib/lttng-ctl/destruction-handle.cpp similarity index 98% rename from src/lib/lttng-ctl/destruction-handle.c rename to src/lib/lttng-ctl/destruction-handle.cpp index 26ae7d306..35a1c3582 100644 --- a/src/lib/lttng-ctl/destruction-handle.c +++ b/src/lib/lttng-ctl/destruction-handle.cpp @@ -19,6 +19,7 @@ #include #include "lttng-ctl-helper.h" +#include #include enum communication_state { @@ -68,7 +69,7 @@ struct lttng_destruction_handle *lttng_destruction_handle_create( int sessiond_socket) { int ret; - struct lttng_destruction_handle *handle = zmalloc(sizeof(*handle)); + struct lttng_destruction_handle *handle = (lttng_destruction_handle *) zmalloc(sizeof(*handle)); if (!handle) { goto end; @@ -304,8 +305,8 @@ lttng_destruction_handle_wait_for_completion( } DBG("%lums elapsed while waiting for session destruction completion", diff_ms); - diff_ms = max_t(unsigned long, diff_ms, 1); - diff_ms = min_t(unsigned long, diff_ms, time_left_ms); + diff_ms = std::max(diff_ms, 1UL); + diff_ms = std::min(diff_ms, time_left_ms); time_left_ms -= diff_ms; } diff --git a/src/lib/lttng-ctl/event.c b/src/lib/lttng-ctl/event.cpp similarity index 97% rename from src/lib/lttng-ctl/event.c rename to src/lib/lttng-ctl/event.cpp index c153b9187..3a6bf22b2 100644 --- a/src/lib/lttng-ctl/event.c +++ b/src/lib/lttng-ctl/event.cpp @@ -24,13 +24,13 @@ struct lttng_event *lttng_event_create(void) struct lttng_event *event; struct lttng_event_extended *event_extended; - event = zmalloc(sizeof(*event)); + event = (lttng_event *) zmalloc(sizeof(*event)); if (!event) { PERROR("Error allocating event structure"); goto end; } - event_extended = zmalloc(sizeof(*event_extended)); + event_extended = (lttng_event_extended *) zmalloc(sizeof(*event_extended)); if (!event_extended) { PERROR("Error allocating event extended structure"); goto error; diff --git a/src/lib/lttng-ctl/load.c b/src/lib/lttng-ctl/load.cpp similarity index 96% rename from src/lib/lttng-ctl/load.c rename to src/lib/lttng-ctl/load.cpp index 4af132675..0032df569 100644 --- a/src/lib/lttng-ctl/load.c +++ b/src/lib/lttng-ctl/load.cpp @@ -22,7 +22,7 @@ struct lttng_load_session_attr *lttng_load_session_attr_create(void) { - return zmalloc(sizeof(struct lttng_load_session_attr)); + return (lttng_load_session_attr *) zmalloc(sizeof(struct lttng_load_session_attr)); } static @@ -272,7 +272,7 @@ int lttng_load_session_attr_set_override_ctrl_url( } if (!attr->override_attr) { - attr->override_attr = zmalloc( + attr->override_attr = (config_load_session_override_attr *) zmalloc( sizeof(struct config_load_session_override_attr)); if (!attr->override_attr) { ret = -LTTNG_ERR_NOMEM; @@ -303,7 +303,7 @@ int lttng_load_session_attr_set_override_ctrl_url( uri[0].port = DEFAULT_NETWORK_CONTROL_PORT; } - url_str = zmalloc(PATH_MAX); + url_str = (char *) zmalloc(PATH_MAX); if (!url_str) { /* FIXME: return valid error */ ret = -LTTNG_ERR_NOMEM; @@ -357,7 +357,7 @@ int lttng_load_session_attr_set_override_data_url( } if (!attr->override_attr) { - attr->override_attr = zmalloc( + attr->override_attr = (config_load_session_override_attr *) zmalloc( sizeof(struct config_load_session_override_attr)); if (!attr->override_attr) { ret = -LTTNG_ERR_NOMEM; @@ -388,7 +388,7 @@ int lttng_load_session_attr_set_override_data_url( uri[0].port = DEFAULT_NETWORK_DATA_PORT; } - url_str = zmalloc(PATH_MAX); + url_str = (char *) zmalloc(PATH_MAX); if (!url_str) { ret = -LTTNG_ERR_NOMEM; goto end; @@ -446,7 +446,7 @@ int lttng_load_session_attr_set_override_url( } if (!attr->override_attr) { - attr->override_attr = zmalloc( + attr->override_attr = (config_load_session_override_attr *) zmalloc( sizeof(struct config_load_session_override_attr)); if (!attr->override_attr) { ret = -LTTNG_ERR_NOMEM; @@ -583,7 +583,7 @@ int lttng_load_session_attr_set_override_session_name( } if (!attr->override_attr) { - attr->override_attr = zmalloc( + attr->override_attr = (config_load_session_override_attr *) zmalloc( sizeof(struct config_load_session_override_attr)); if (!attr->override_attr) { ret = -LTTNG_ERR_NOMEM; diff --git a/src/lib/lttng-ctl/lttng-ctl-health.c b/src/lib/lttng-ctl/lttng-ctl-health.cpp similarity index 69% rename from src/lib/lttng-ctl/lttng-ctl-health.c rename to src/lib/lttng-ctl/lttng-ctl-health.cpp index 955b1fcd0..2a992830d 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.c +++ b/src/lib/lttng-ctl/lttng-ctl-health.cpp @@ -51,45 +51,99 @@ struct lttng_health { }; static -const char *sessiond_thread_name[NR_HEALTH_SESSIOND_TYPES] = { - [ HEALTH_SESSIOND_TYPE_CMD ] = "Session daemon command", - [ HEALTH_SESSIOND_TYPE_APP_MANAGE ] = "Session daemon application manager", - [ HEALTH_SESSIOND_TYPE_APP_REG ] = "Session daemon application registration", - [ HEALTH_SESSIOND_TYPE_KERNEL ] = "Session daemon kernel", - [ HEALTH_SESSIOND_TYPE_CONSUMER ] = "Session daemon consumer manager", - [ HEALTH_SESSIOND_TYPE_HT_CLEANUP ] = "Session daemon hash table cleanup", - [ HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY ] = "Session daemon application notification manager", - [ HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH ] = "Session daemon application registration dispatcher", - [ HEALTH_SESSIOND_TYPE_ROTATION ] = "Session daemon rotation manager", - [ HEALTH_SESSIOND_TYPE_TIMER ] = "Session daemon timer manager", - [ HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR ] = "Session daemon trigger action executor", +const char *get_sessiond_thread_name(health_type_sessiond type) { + switch (type) + { + case HEALTH_SESSIOND_TYPE_CMD: + return "Session daemon command"; + case HEALTH_SESSIOND_TYPE_APP_MANAGE: + return "Session daemon application manager"; + case HEALTH_SESSIOND_TYPE_APP_REG: + return "Session daemon application registration"; + case HEALTH_SESSIOND_TYPE_KERNEL: + return "Session daemon kernel"; + case HEALTH_SESSIOND_TYPE_CONSUMER: + return "Session daemon consumer manager"; + case HEALTH_SESSIOND_TYPE_HT_CLEANUP: + return "Session daemon hash table cleanup"; + case HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY: + return "Session daemon application notification manager"; + case HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH: + return "Session daemon application registration dispatcher"; + case HEALTH_SESSIOND_TYPE_NOTIFICATION: + return "Session daemon notification"; + case HEALTH_SESSIOND_TYPE_ROTATION: + return "Session daemon rotation manager"; + case HEALTH_SESSIOND_TYPE_TIMER: + return "Session daemon timer manager"; + case HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR: + return "Session daemon trigger action executor"; + case NR_HEALTH_SESSIOND_TYPES: + abort(); + } + + abort(); }; static -const char *consumerd_thread_name[NR_HEALTH_CONSUMERD_TYPES] = { - [ HEALTH_CONSUMERD_TYPE_CHANNEL ] = "Consumer daemon channel", - [ HEALTH_CONSUMERD_TYPE_METADATA ] = "Consumer daemon metadata", - [ HEALTH_CONSUMERD_TYPE_DATA ] = "Consumer daemon data", - [ HEALTH_CONSUMERD_TYPE_SESSIOND ] = "Consumer daemon session daemon command manager", - [ HEALTH_CONSUMERD_TYPE_METADATA_TIMER ] = "Consumer daemon metadata timer", +const char *get_consumerd_thread_name(health_type_consumerd type) { + switch (type) { + case HEALTH_CONSUMERD_TYPE_CHANNEL: + return "Consumer daemon channel"; + case HEALTH_CONSUMERD_TYPE_METADATA: + return "Consumer daemon metadata"; + case HEALTH_CONSUMERD_TYPE_DATA: + return "Consumer daemon data"; + case HEALTH_CONSUMERD_TYPE_SESSIOND: + return "Consumer daemon session daemon command manager"; + case HEALTH_CONSUMERD_TYPE_METADATA_TIMER: + return "Consumer daemon metadata timer"; + case NR_HEALTH_CONSUMERD_TYPES: + abort(); + } + + abort(); }; static -const char *relayd_thread_name[NR_HEALTH_RELAYD_TYPES] = { - [ HEALTH_RELAYD_TYPE_DISPATCHER ] = "Relay daemon dispatcher", - [ HEALTH_RELAYD_TYPE_WORKER ] = "Relay daemon worker", - [ HEALTH_RELAYD_TYPE_LISTENER ] = "Relay daemon listener", - [ HEALTH_RELAYD_TYPE_LIVE_DISPATCHER ] = "Relay daemon live dispatcher", - [ HEALTH_RELAYD_TYPE_LIVE_WORKER ] = "Relay daemon live worker", - [ HEALTH_RELAYD_TYPE_LIVE_LISTENER ] = "Relay daemon live listener", -}; +const char *get_relayd_thread_name(health_type_relayd type) +{ + switch (type) { + case HEALTH_RELAYD_TYPE_DISPATCHER: + return "Relay daemon dispatcher"; + case HEALTH_RELAYD_TYPE_WORKER: + return "Relay daemon worker"; + case HEALTH_RELAYD_TYPE_LISTENER: + return "Relay daemon listener"; + case HEALTH_RELAYD_TYPE_LIVE_DISPATCHER: + return "Relay daemon live dispatcher"; + case HEALTH_RELAYD_TYPE_LIVE_WORKER: + return "Relay daemon live worker"; + case HEALTH_RELAYD_TYPE_LIVE_LISTENER: + return "Relay daemon live listener"; + case NR_HEALTH_RELAYD_TYPES: + abort(); + } + + abort(); +} static -const char **thread_name[NR_HEALTH_COMPONENT] = { - [ HEALTH_COMPONENT_SESSIOND ] = sessiond_thread_name, - [ HEALTH_COMPONENT_CONSUMERD] = consumerd_thread_name, - [ HEALTH_COMPONENT_RELAYD ] = relayd_thread_name, -}; +const char *get_thread_name(int comp, int nr) +{ + switch (comp) { + case HEALTH_COMPONENT_SESSIOND: + return get_sessiond_thread_name((health_type_sessiond) nr); + case HEALTH_COMPONENT_CONSUMERD: + return get_consumerd_thread_name((health_type_consumerd) nr); + case HEALTH_COMPONENT_RELAYD: + return get_relayd_thread_name((health_type_relayd) nr); + case NR_HEALTH_COMPONENT: + abort(); + } + + abort(); +} /* * Set health socket path. @@ -176,7 +230,7 @@ struct lttng_health *lttng_health_create(enum health_component hc, struct lttng_health *lh; int i; - lh = zmalloc(sizeof(*lh) + sizeof(lh->thread[0]) * nr_threads); + lh = (lttng_health *) zmalloc(sizeof(*lh) + sizeof(lh->thread[0]) * nr_threads); if (!lh) { return NULL; } @@ -362,5 +416,5 @@ const char *lttng_health_thread_name(const struct lttng_health_thread *thread) return NULL; } nr = thread - &thread->p->thread[0]; - return thread_name[thread->p->component][nr]; + return get_thread_name (thread->p->component, nr); } diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.cpp similarity index 98% rename from src/lib/lttng-ctl/lttng-ctl.c rename to src/lib/lttng-ctl/lttng-ctl.cpp index 83a884c17..362298718 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.cpp @@ -73,9 +73,9 @@ static int connected; * error message. They are global to the library so application linking with it * are able to compile correctly and also control verbosity of the library. */ -int lttng_opt_quiet; -int lttng_opt_verbose; -int lttng_opt_mi; +LTTNG_EXPORT int lttng_opt_quiet; +LTTNG_EXPORT int lttng_opt_verbose; +LTTNG_EXPORT int lttng_opt_mi; /* * Copy domain to lttcomm_session_msg domain. @@ -116,7 +116,7 @@ static int send_session_msg(struct lttcomm_session_msg *lsm) goto end; } - DBG("LSM cmd type: '%s' (%d)", lttcomm_sessiond_command_str(lsm->cmd_type), + DBG("LSM cmd type: '%s' (%d)", lttcomm_sessiond_command_str((lttcomm_sessiond_command) lsm->cmd_type), lsm->cmd_type); ret = lttcomm_send_creds_unix_sock(sessiond_socket, lsm, @@ -265,7 +265,7 @@ int lttng_check_tracing_group(void) } /* Alloc group list of the right size */ - grp_list = zmalloc(grp_list_size * sizeof(gid_t)); + grp_list = (gid_t *) zmalloc(grp_list_size * sizeof(gid_t)); if (!grp_list) { PERROR("malloc"); goto end; @@ -710,7 +710,7 @@ struct lttng_handle *lttng_create_handle(const char *session_name, int ret; struct lttng_handle *handle = NULL; - handle = zmalloc(sizeof(struct lttng_handle)); + handle = (lttng_handle *) zmalloc(sizeof(struct lttng_handle)); if (handle == NULL) { PERROR("malloc handle"); goto end; @@ -950,7 +950,7 @@ int lttng_add_context(struct lttng_handle *handle, lsm.u.context.context_name_len = ctx_len; len = provider_len + ctx_len; - buf = zmalloc(len); + buf = (char *) zmalloc(len); if (!buf) { ret = -LTTNG_ERR_NOMEM; goto end; @@ -1434,7 +1434,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle, lsm.u.enable.expression_len = strlen(filter_expression) + 1; } - varlen_data = zmalloc(lsm.u.disable.bytecode_len + varlen_data = (char *) zmalloc(lsm.u.disable.bytecode_len + lsm.u.disable.expression_len); if (!varlen_data) { ret = -LTTNG_ERR_EXCLUSION_NOMEM; @@ -1541,12 +1541,12 @@ struct lttng_channel *lttng_channel_create(struct lttng_domain *domain) goto error; } - channel = zmalloc(sizeof(*channel)); + channel = (lttng_channel *) zmalloc(sizeof(*channel)); if (!channel) { goto error; } - extended = zmalloc(sizeof(*extended)); + extended = (lttng_channel_extended *) zmalloc(sizeof(*extended)); if (!extended) { goto error; } @@ -1833,7 +1833,7 @@ enum lttng_error_code lttng_create_session_ext( reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, payload.data, payload.size, &reply); if (reply_ret < 0) { - ret_code = -reply_ret; + ret_code = (lttng_error_code) -reply_ret; goto end; } else if (reply_ret == 0) { /* Socket unexpectedly closed by the session daemon. */ @@ -1841,7 +1841,7 @@ enum lttng_error_code lttng_create_session_ext( goto end; } - reply_view = lttng_buffer_view_init(reply, 0, reply_ret); + reply_view = lttng_buffer_view_init((const char *) reply, 0, reply_ret); ret = lttng_session_descriptor_create_from_buffer(&reply_view, &descriptor_reply); if (ret < 0) { @@ -2143,7 +2143,7 @@ enum lttng_error_code lttng_session_get_creation_time( goto end; } - extended = session->extended.ptr; + extended = (lttng_session_extended *) session->extended.ptr; if (!extended->creation_time.is_set) { /* Not created on the session daemon yet. */ ret = LTTNG_ERR_SESSION_NOT_EXIST; @@ -2237,7 +2237,7 @@ int lttng_list_channels(struct lttng_handle *handle, const size_t channel_size = sizeof(struct lttng_channel) + sizeof(struct lttng_channel_extended); struct lttcomm_session_msg lsm; - void *extended_at; + char *extended_at; if (handle == NULL) { ret = -LTTNG_ERR_INVALID; @@ -2269,7 +2269,7 @@ int lttng_list_channels(struct lttng_handle *handle, channel_count = (size_t) ret / channel_size; /* Set extended info pointers */ - extended_at = ((void *) *channels) + + extended_at = ((char *) *channels) + channel_count * sizeof(struct lttng_channel); for (i = 0; i < channel_count; i++) { struct lttng_channel *chan = &(*channels)[i]; @@ -2296,7 +2296,7 @@ int lttng_list_events(struct lttng_handle *handle, struct lttcomm_session_msg lsm = {}; const struct lttcomm_event_command_header *cmd_header = NULL; uint32_t nb_events, i; - const void *comm_ext_at; + const char *comm_ext_at; struct lttng_dynamic_buffer listing; size_t storage_req; struct lttng_payload payload; @@ -2735,7 +2735,7 @@ int lttng_channel_get_discarded_event_count(struct lttng_channel *channel, goto end; } - chan_ext = channel->attr.extended.ptr; + chan_ext = (lttng_channel_extended *) channel->attr.extended.ptr; if (!chan_ext) { /* * This can happen since the lttng_channel structure is @@ -2761,7 +2761,7 @@ int lttng_channel_get_lost_packet_count(struct lttng_channel *channel, goto end; } - chan_ext = channel->attr.extended.ptr; + chan_ext = (lttng_channel_extended *) channel->attr.extended.ptr; if (!chan_ext) { /* * This can happen since the lttng_channel structure is @@ -2953,7 +2953,8 @@ error: /* * [OBSOLETE] */ -int lttng_enable_consumer(struct lttng_handle *handle); +extern "C" +LTTNG_EXPORT int lttng_enable_consumer(struct lttng_handle *handle); int lttng_enable_consumer(struct lttng_handle *handle) { return -ENOSYS; @@ -2962,7 +2963,8 @@ int lttng_enable_consumer(struct lttng_handle *handle) /* * [OBSOLETE] */ -int lttng_disable_consumer(struct lttng_handle *handle); +extern "C" +LTTNG_EXPORT int lttng_disable_consumer(struct lttng_handle *handle); int lttng_disable_consumer(struct lttng_handle *handle) { return -ENOSYS; @@ -2971,7 +2973,8 @@ int lttng_disable_consumer(struct lttng_handle *handle) /* * [OBSOLETE] */ -int _lttng_create_session_ext(const char *name, const char *url, +extern "C" +LTTNG_EXPORT int _lttng_create_session_ext(const char *name, const char *url, const char *datetime); int _lttng_create_session_ext(const char *name, const char *url, const char *datetime) @@ -3106,8 +3109,8 @@ int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name, int ret; struct lttcomm_session_msg lsm = { .cmd_type = LTTNG_REGISTER_TRIGGER, - .u.trigger.is_trigger_anonymous = !name && !generate_name, }; + lsm.u.trigger.is_trigger_anonymous = !name && !generate_name; struct lttcomm_session_msg *message_lsm; struct lttng_payload message; struct lttng_payload reply; @@ -3264,7 +3267,7 @@ enum lttng_error_code lttng_register_trigger_with_name( enum lttng_error_code lttng_register_trigger_with_automatic_name( struct lttng_trigger *trigger) { - const int ret = _lttng_register_trigger(trigger, false, true); + const int ret = _lttng_register_trigger(trigger, nullptr, true); return ret == 0 ? LTTNG_OK : (enum lttng_error_code) -ret; } @@ -3321,7 +3324,7 @@ enum lttng_error_code lttng_error_query_execute( &message_view); ret = lttng_ctl_ask_sessiond_payload(&message_view, &reply); if (ret < 0) { - ret_code = -ret; + ret_code =(lttng_error_code) -ret; goto end; } } diff --git a/src/lib/lttng-ctl/rotate.c b/src/lib/lttng-ctl/rotate.cpp similarity index 97% rename from src/lib/lttng-ctl/rotate.c rename to src/lib/lttng-ctl/rotate.cpp index d13194404..6a003a18e 100644 --- a/src/lib/lttng-ctl/rotate.c +++ b/src/lib/lttng-ctl/rotate.cpp @@ -68,7 +68,7 @@ create_trace_archive_location_from_get_info( case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY: location = lttng_trace_archive_location_relay_create( info->location.relay.host, - info->location.relay.protocol, + (lttng_trace_archive_location_relay_protocol_type) info->location.relay.protocol, info->location.relay.ports.control, info->location.relay.ports.data, info->location.relay.relative_path); @@ -230,7 +230,7 @@ int lttng_rotate_session(const char *session_name, goto end; } - *rotation_handle = zmalloc(sizeof(struct lttng_rotation_handle)); + *rotation_handle = (lttng_rotation_handle *) zmalloc(sizeof(struct lttng_rotation_handle)); if (!*rotation_handle) { ret = -LTTNG_ERR_NOMEM; goto end; @@ -350,7 +350,7 @@ end: static struct lttng_rotation_schedules *lttng_rotation_schedules_create(void) { - return zmalloc(sizeof(struct lttng_rotation_schedules)); + return (lttng_rotation_schedules *) zmalloc(sizeof(struct lttng_rotation_schedules)); } static @@ -463,7 +463,7 @@ lttng_rotation_schedule_size_threshold_create(void) { struct lttng_rotation_schedule_size_threshold *schedule; - schedule = zmalloc(sizeof(*schedule)); + schedule = (lttng_rotation_schedule_size_threshold *) zmalloc(sizeof(*schedule)); if (!schedule) { goto end; } @@ -529,7 +529,7 @@ lttng_rotation_schedule_periodic_create(void) { struct lttng_rotation_schedule_periodic *schedule; - schedule = zmalloc(sizeof(*schedule)); + schedule = (lttng_rotation_schedule_periodic *) zmalloc(sizeof(*schedule)); if (!schedule) { goto end; } diff --git a/src/lib/lttng-ctl/save.c b/src/lib/lttng-ctl/save.cpp similarity index 97% rename from src/lib/lttng-ctl/save.c rename to src/lib/lttng-ctl/save.cpp index c8d8ac9c2..45894277a 100644 --- a/src/lib/lttng-ctl/save.c +++ b/src/lib/lttng-ctl/save.cpp @@ -17,7 +17,7 @@ struct lttng_save_session_attr *lttng_save_session_attr_create(void) { - return zmalloc(sizeof(struct lttng_save_session_attr)); + return (lttng_save_session_attr *) zmalloc(sizeof(struct lttng_save_session_attr)); } void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output) diff --git a/src/lib/lttng-ctl/snapshot.c b/src/lib/lttng-ctl/snapshot.cpp similarity index 98% rename from src/lib/lttng-ctl/snapshot.c rename to src/lib/lttng-ctl/snapshot.cpp index e90062352..543861d67 100644 --- a/src/lib/lttng-ctl/snapshot.c +++ b/src/lib/lttng-ctl/snapshot.cpp @@ -120,7 +120,7 @@ int lttng_snapshot_list_output(const char *session_name, goto error; } - new_list = zmalloc(sizeof(*new_list)); + new_list = (lttng_snapshot_output_list *) zmalloc(sizeof(*new_list)); if (!new_list) { ret = -LTTNG_ERR_NOMEM; goto error; @@ -239,7 +239,7 @@ struct lttng_snapshot_output *lttng_snapshot_output_create(void) { struct lttng_snapshot_output *output; - output = zmalloc(sizeof(struct lttng_snapshot_output)); + output = (lttng_snapshot_output *) zmalloc(sizeof(struct lttng_snapshot_output)); if (!output) { goto error; } diff --git a/src/lib/lttng-ctl/tracker.c b/src/lib/lttng-ctl/tracker.cpp similarity index 99% rename from src/lib/lttng-ctl/tracker.c rename to src/lib/lttng-ctl/tracker.cpp index 4eae95fc5..1259729ea 100644 --- a/src/lib/lttng-ctl/tracker.c +++ b/src/lib/lttng-ctl/tracker.cpp @@ -51,7 +51,7 @@ enum lttng_error_code lttng_session_get_tracker_handle(const char *session_name, goto error; } - handle = zmalloc(sizeof(*handle)); + handle = (lttng_process_attr_tracker_handle *) zmalloc(sizeof(*handle)); if (!handle) { ret_code = LTTNG_ERR_NOMEM; goto error; @@ -367,7 +367,7 @@ lttng_process_attr_tracker_handle_get_inclusion_set( struct lttng_process_attr_tracker_handle *tracker, const struct lttng_process_attr_values **values) { - void *reply = NULL; + char *reply = NULL; int reply_ret, copy_ret; enum lttng_process_attr_tracker_handle_status status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK; @@ -398,7 +398,7 @@ lttng_process_attr_tracker_handle_get_inclusion_set( /* Command returns a session descriptor on success. */ reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header( - &lsm, NULL, 0, &reply); + &lsm, NULL, 0, (void **) &reply); if (reply_ret < 0) { if (reply_ret == -LTTNG_ERR_SESSION_NOT_EXIST) { status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST; @@ -755,7 +755,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, goto end; } - pid_array = zmalloc(pid_count * sizeof(int32_t)); + pid_array = (int32_t *) zmalloc(pid_count * sizeof(int32_t)); if (!pid_array) { ret_code = LTTNG_ERR_NOMEM; goto end; diff --git a/tests/regression/tools/health/health_fail.c b/tests/regression/tools/health/health_fail.c index ca2bc3485..6a4c8f08a 100644 --- a/tests/regression/tools/health/health_fail.c +++ b/tests/regression/tools/health/health_fail.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -30,7 +31,7 @@ int check_env_var(const char *env) /* Session daemon */ -int __testpoint_sessiond_thread_manage_clients(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_clients(void); int __testpoint_sessiond_thread_manage_clients(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_TP_FAIL"; @@ -42,7 +43,7 @@ int __testpoint_sessiond_thread_manage_clients(void) return 0; } -int __testpoint_sessiond_thread_registration_apps(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_registration_apps(void); int __testpoint_sessiond_thread_registration_apps(void) { const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_TP_FAIL"; @@ -54,7 +55,7 @@ int __testpoint_sessiond_thread_registration_apps(void) return 0; } -int __testpoint_sessiond_thread_manage_apps(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_apps(void); int __testpoint_sessiond_thread_manage_apps(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_TP_FAIL"; @@ -66,7 +67,7 @@ int __testpoint_sessiond_thread_manage_apps(void) return 0; } -int __testpoint_sessiond_thread_manage_kernel(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_kernel(void); int __testpoint_sessiond_thread_manage_kernel(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_TP_FAIL"; @@ -78,7 +79,7 @@ int __testpoint_sessiond_thread_manage_kernel(void) return 0; } -int __testpoint_sessiond_thread_manage_consumer(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_consumer(void); int __testpoint_sessiond_thread_manage_consumer(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_TP_FAIL"; @@ -90,7 +91,7 @@ int __testpoint_sessiond_thread_manage_consumer(void) return 0; } -int __testpoint_sessiond_thread_ht_cleanup(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_ht_cleanup(void); int __testpoint_sessiond_thread_ht_cleanup(void) { const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_TP_FAIL"; @@ -102,7 +103,7 @@ int __testpoint_sessiond_thread_ht_cleanup(void) return 0; } -int __testpoint_sessiond_thread_app_manage_notify(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_app_manage_notify(void); int __testpoint_sessiond_thread_app_manage_notify(void) { const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_TP_FAIL"; @@ -114,7 +115,7 @@ int __testpoint_sessiond_thread_app_manage_notify(void) return 0; } -int __testpoint_sessiond_thread_app_reg_dispatch(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_app_reg_dispatch(void); int __testpoint_sessiond_thread_app_reg_dispatch(void) { const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_TP_FAIL"; @@ -128,7 +129,7 @@ int __testpoint_sessiond_thread_app_reg_dispatch(void) /* Consumer daemon */ -int __testpoint_consumerd_thread_channel(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_channel(void); int __testpoint_consumerd_thread_channel(void) { const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_TP_FAIL"; @@ -140,7 +141,7 @@ int __testpoint_consumerd_thread_channel(void) return 0; } -int __testpoint_consumerd_thread_metadata(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_metadata(void); int __testpoint_consumerd_thread_metadata(void) { const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TP_FAIL"; @@ -152,7 +153,7 @@ int __testpoint_consumerd_thread_metadata(void) return 0; } -int __testpoint_consumerd_thread_data(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_data(void); int __testpoint_consumerd_thread_data(void) { const char *var = "LTTNG_CONSUMERD_THREAD_DATA_TP_FAIL"; @@ -164,7 +165,7 @@ int __testpoint_consumerd_thread_data(void) return 0; } -int __testpoint_consumerd_thread_sessiond(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_sessiond(void); int __testpoint_consumerd_thread_sessiond(void) { const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_TP_FAIL"; @@ -176,7 +177,7 @@ int __testpoint_consumerd_thread_sessiond(void) return 0; } -int __testpoint_consumerd_thread_metadata_timer(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_metadata_timer(void); int __testpoint_consumerd_thread_metadata_timer(void) { const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_TP_FAIL"; @@ -190,7 +191,7 @@ int __testpoint_consumerd_thread_metadata_timer(void) /* Relay daemon */ -int __testpoint_relayd_thread_dispatcher(void); +LTTNG_EXPORT int __testpoint_relayd_thread_dispatcher(void); int __testpoint_relayd_thread_dispatcher(void) { const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_TP_FAIL"; @@ -202,7 +203,7 @@ int __testpoint_relayd_thread_dispatcher(void) return 0; } -int __testpoint_relayd_thread_worker(void); +LTTNG_EXPORT int __testpoint_relayd_thread_worker(void); int __testpoint_relayd_thread_worker(void) { const char *var = "LTTNG_RELAYD_THREAD_WORKER_TP_FAIL"; @@ -214,7 +215,7 @@ int __testpoint_relayd_thread_worker(void) return 0; } -int __testpoint_relayd_thread_listener(void); +LTTNG_EXPORT int __testpoint_relayd_thread_listener(void); int __testpoint_relayd_thread_listener(void) { const char *var = "LTTNG_RELAYD_THREAD_LISTENER_TP_FAIL"; @@ -226,7 +227,7 @@ int __testpoint_relayd_thread_listener(void) return 0; } -int __testpoint_relayd_thread_live_dispatcher(void); +LTTNG_EXPORT int __testpoint_relayd_thread_live_dispatcher(void); int __testpoint_relayd_thread_live_dispatcher(void) { const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_TP_FAIL"; @@ -238,7 +239,7 @@ int __testpoint_relayd_thread_live_dispatcher(void) return 0; } -int __testpoint_relayd_thread_live_worker(void); +LTTNG_EXPORT int __testpoint_relayd_thread_live_worker(void); int __testpoint_relayd_thread_live_worker(void) { const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_TP_FAIL"; @@ -250,7 +251,7 @@ int __testpoint_relayd_thread_live_worker(void) return 0; } -int __testpoint_relayd_thread_live_listener(void); +LTTNG_EXPORT int __testpoint_relayd_thread_live_listener(void); int __testpoint_relayd_thread_live_listener(void) { const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_TP_FAIL"; diff --git a/tests/regression/tools/health/health_stall.c b/tests/regression/tools/health/health_stall.c index 1c0d6dc77..e89966315 100644 --- a/tests/regression/tools/health/health_stall.c +++ b/tests/regression/tools/health/health_stall.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -43,7 +44,7 @@ void do_stall(void) /* Session daemon */ -int __testpoint_sessiond_thread_manage_clients(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_clients(void); int __testpoint_sessiond_thread_manage_clients(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_STALL"; @@ -55,7 +56,7 @@ int __testpoint_sessiond_thread_manage_clients(void) return 0; } -int __testpoint_sessiond_thread_registration_apps(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_registration_apps(void); int __testpoint_sessiond_thread_registration_apps(void) { const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_STALL"; @@ -67,7 +68,7 @@ int __testpoint_sessiond_thread_registration_apps(void) return 0; } -int __testpoint_sessiond_thread_manage_apps(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_apps(void); int __testpoint_sessiond_thread_manage_apps(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_STALL"; @@ -79,7 +80,7 @@ int __testpoint_sessiond_thread_manage_apps(void) return 0; } -int __testpoint_sessiond_thread_manage_kernel(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_kernel(void); int __testpoint_sessiond_thread_manage_kernel(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_STALL"; @@ -91,7 +92,7 @@ int __testpoint_sessiond_thread_manage_kernel(void) return 0; } -int __testpoint_sessiond_thread_manage_consumer(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_manage_consumer(void); int __testpoint_sessiond_thread_manage_consumer(void) { const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_STALL"; @@ -103,7 +104,7 @@ int __testpoint_sessiond_thread_manage_consumer(void) return 0; } -int __testpoint_sessiond_thread_ht_cleanup(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_ht_cleanup(void); int __testpoint_sessiond_thread_ht_cleanup(void) { const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_STALL"; @@ -115,7 +116,7 @@ int __testpoint_sessiond_thread_ht_cleanup(void) return 0; } -int __testpoint_sessiond_thread_app_manage_notify(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_app_manage_notify(void); int __testpoint_sessiond_thread_app_manage_notify(void) { const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_STALL"; @@ -127,7 +128,7 @@ int __testpoint_sessiond_thread_app_manage_notify(void) return 0; } -int __testpoint_sessiond_thread_app_reg_dispatch(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_app_reg_dispatch(void); int __testpoint_sessiond_thread_app_reg_dispatch(void) { const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_STALL"; @@ -141,7 +142,7 @@ int __testpoint_sessiond_thread_app_reg_dispatch(void) /* Consumer daemon */ -int __testpoint_consumerd_thread_channel(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_channel(void); int __testpoint_consumerd_thread_channel(void) { const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_STALL"; @@ -153,7 +154,7 @@ int __testpoint_consumerd_thread_channel(void) return 0; } -int __testpoint_consumerd_thread_metadata(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_metadata(void); int __testpoint_consumerd_thread_metadata(void) { const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_STALL"; @@ -165,7 +166,7 @@ int __testpoint_consumerd_thread_metadata(void) return 0; } -int __testpoint_consumerd_thread_data(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_data(void); int __testpoint_consumerd_thread_data(void) { const char *var = "LTTNG_CONSUMERD_THREAD_DATA_STALL"; @@ -177,7 +178,7 @@ int __testpoint_consumerd_thread_data(void) return 0; } -int __testpoint_consumerd_thread_sessiond(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_sessiond(void); int __testpoint_consumerd_thread_sessiond(void) { const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_STALL"; @@ -189,7 +190,7 @@ int __testpoint_consumerd_thread_sessiond(void) return 0; } -int __testpoint_consumerd_thread_metadata_timer(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_metadata_timer(void); int __testpoint_consumerd_thread_metadata_timer(void) { const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_STALL"; @@ -203,7 +204,7 @@ int __testpoint_consumerd_thread_metadata_timer(void) /* Relay daemon */ -int __testpoint_relayd_thread_dispatcher(void); +LTTNG_EXPORT int __testpoint_relayd_thread_dispatcher(void); int __testpoint_relayd_thread_dispatcher(void) { const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_STALL"; @@ -215,7 +216,7 @@ int __testpoint_relayd_thread_dispatcher(void) return 0; } -int __testpoint_relayd_thread_worker(void); +LTTNG_EXPORT int __testpoint_relayd_thread_worker(void); int __testpoint_relayd_thread_worker(void) { const char *var = "LTTNG_RELAYD_THREAD_WORKER_STALL"; @@ -227,7 +228,7 @@ int __testpoint_relayd_thread_worker(void) return 0; } -int __testpoint_relayd_thread_listener(void); +LTTNG_EXPORT int __testpoint_relayd_thread_listener(void); int __testpoint_relayd_thread_listener(void) { const char *var = "LTTNG_RELAYD_THREAD_LISTENER_STALL"; @@ -239,7 +240,7 @@ int __testpoint_relayd_thread_listener(void) return 0; } -int __testpoint_relayd_thread_live_dispatcher(void); +LTTNG_EXPORT int __testpoint_relayd_thread_live_dispatcher(void); int __testpoint_relayd_thread_live_dispatcher(void) { const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_STALL"; @@ -251,7 +252,7 @@ int __testpoint_relayd_thread_live_dispatcher(void) return 0; } -int __testpoint_relayd_thread_live_worker(void); +LTTNG_EXPORT int __testpoint_relayd_thread_live_worker(void); int __testpoint_relayd_thread_live_worker(void) { const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_STALL"; @@ -263,7 +264,7 @@ int __testpoint_relayd_thread_live_worker(void) return 0; } -int __testpoint_relayd_thread_live_listener(void); +LTTNG_EXPORT int __testpoint_relayd_thread_live_listener(void); int __testpoint_relayd_thread_live_listener(void) { const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_STALL"; diff --git a/tests/regression/tools/live/live_test.c b/tests/regression/tools/live/live_test.c index b428f1add..40d0f6270 100644 --- a/tests/regression/tools/live/live_test.c +++ b/tests/regression/tools/live/live_test.c @@ -41,8 +41,9 @@ #define mmap_size 524288 #ifdef HAVE_LIBLTTNG_UST_CTL +#include #include -DEFINE_LTTNG_UST_SIGBUS_STATE(); +LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); #endif static int control_sock; diff --git a/tests/regression/tools/notification/consumer_testpoints.c b/tests/regression/tools/notification/consumer_testpoints.c index c4fc0a057..6294683f9 100644 --- a/tests/regression/tools/notification/consumer_testpoints.c +++ b/tests/regression/tools/notification/consumer_testpoints.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -46,7 +47,7 @@ void __attribute__((destructor)) pause_pipe_fini(void) * thread to create a named pipe/FIFO which a test application can use to either * pause or resume the consumption of data. */ -int __testpoint_consumerd_thread_data(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_data(void); int __testpoint_consumerd_thread_data(void) { int ret = 0; @@ -106,7 +107,7 @@ end: return ret; } -int __testpoint_consumerd_thread_data_poll(void); +LTTNG_EXPORT int __testpoint_consumerd_thread_data_poll(void); int __testpoint_consumerd_thread_data_poll(void) { int ret = 0; diff --git a/tests/regression/tools/notification/sessiond_testpoints.c b/tests/regression/tools/notification/sessiond_testpoints.c index 21f04cda7..2bfd7cab7 100644 --- a/tests/regression/tools/notification/sessiond_testpoints.c +++ b/tests/regression/tools/notification/sessiond_testpoints.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -42,7 +43,7 @@ void __attribute__((destructor)) pause_pipe_fini(void) lttng_pipe_destroy(pause_pipe); } -int __testpoint_sessiond_thread_notification(void); +LTTNG_EXPORT int __testpoint_sessiond_thread_notification(void); int __testpoint_sessiond_thread_notification(void) { int ret = 0; @@ -79,7 +80,7 @@ end: return ret; } -int __testpoint_sessiond_handle_notifier_event_pipe(void); +LTTNG_EXPORT int __testpoint_sessiond_handle_notifier_event_pipe(void); int __testpoint_sessiond_handle_notifier_event_pipe(void) { int ret = 0; diff --git a/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c b/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c index dace1d99c..a12a5b76b 100644 --- a/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c +++ b/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c @@ -14,6 +14,7 @@ #include #include #include +#include #include static @@ -49,7 +50,7 @@ const char *plugin_description(void) return "Freeze time with 1KHz for regression test"; } -void lttng_ust_clock_plugin_init(void); +LTTNG_EXPORT void lttng_ust_clock_plugin_init(void); void lttng_ust_clock_plugin_init(void) { int ret; diff --git a/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c b/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c index 976bcb231..dbe6c1d86 100644 --- a/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c +++ b/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c @@ -14,6 +14,7 @@ #include #include #include +#include #include static long nprocessors; @@ -58,7 +59,7 @@ int plugin_getcpu(void) return ret; } -void lttng_ust_getcpu_plugin_init(void); +LTTNG_EXPORT void lttng_ust_getcpu_plugin_init(void); void lttng_ust_getcpu_plugin_init(void) { int ret; diff --git a/tests/regression/ust/multi-lib/callsites.h b/tests/regression/ust/multi-lib/callsites.h index 059d8f791..117aae8d3 100644 --- a/tests/regression/ust/multi-lib/callsites.h +++ b/tests/regression/ust/multi-lib/callsites.h @@ -7,5 +7,9 @@ #ifndef CALLSITES_H #define CALLSITES_H -void call_tracepoint(void); + +#include + +LTTNG_EXPORT void call_tracepoint(void); + #endif /* CALLSITES_H */ diff --git a/tests/regression/ust/ust-dl/libbar.h b/tests/regression/ust/ust-dl/libbar.h index a7f77458f..1f1a0bbfd 100644 --- a/tests/regression/ust/ust-dl/libbar.h +++ b/tests/regression/ust/ust-dl/libbar.h @@ -8,6 +8,8 @@ #ifndef _LIBBAR_H #define _LIBBAR_H -int bar(void); +#include + +LTTNG_EXPORT int bar(void); #endif /* _LIBBAR_H */ diff --git a/tests/regression/ust/ust-dl/libfoo.h b/tests/regression/ust/ust-dl/libfoo.h index f33442850..43ae5b9b8 100644 --- a/tests/regression/ust/ust-dl/libfoo.h +++ b/tests/regression/ust/ust-dl/libfoo.h @@ -8,6 +8,8 @@ #ifndef _LIBFOO_H #define _LIBFOO_H -int foo(void); +#include + +LTTNG_EXPORT int foo(void); #endif /* _LIBFOO_H */ diff --git a/tests/unit/test_kernel_data.cpp b/tests/unit/test_kernel_data.cpp index 79489e3d3..6f0ce872b 100644 --- a/tests/unit/test_kernel_data.cpp +++ b/tests/unit/test_kernel_data.cpp @@ -23,8 +23,9 @@ #define NUM_TESTS 11 #ifdef HAVE_LIBLTTNG_UST_CTL +#include #include -DEFINE_LTTNG_UST_SIGBUS_STATE(); +LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); #endif static const char alphanum[] = diff --git a/tests/unit/test_ust_data.cpp b/tests/unit/test_ust_data.cpp index a6dfba429..f1b197ea9 100644 --- a/tests/unit/test_ust_data.cpp +++ b/tests/unit/test_ust_data.cpp @@ -32,7 +32,7 @@ /* Number of TAP tests in this file */ #define NUM_TESTS 16 -DEFINE_LTTNG_UST_SIGBUS_STATE(); +LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); static const char alphanum[] = "0123456789" diff --git a/tests/unit/ust-sigbus.c b/tests/unit/ust-sigbus.c index 4dbdddefa..3b9dd771d 100644 --- a/tests/unit/ust-sigbus.c +++ b/tests/unit/ust-sigbus.c @@ -5,6 +5,7 @@ * */ +#include #include -DEFINE_LTTNG_UST_SIGBUS_STATE(); +LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); diff --git a/tests/utils/testapp/userspace-probe-elf-binary/foo.h b/tests/utils/testapp/userspace-probe-elf-binary/foo.h index d1d79eeae..fb1f19de3 100644 --- a/tests/utils/testapp/userspace-probe-elf-binary/foo.h +++ b/tests/utils/testapp/userspace-probe-elf-binary/foo.h @@ -5,4 +5,6 @@ * */ -int dynamic_symbol(int a); +#include + +LTTNG_EXPORT int dynamic_symbol(int a); -- 2.34.1