lib: compile liblttng-ctl as C++
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 6 Oct 2021 16:15:33 +0000 (12:15 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 17 Nov 2021 23:30:51 +0000 (18:30 -0500)
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 <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
111 files changed:
configure.ac
include/Makefile.am
include/lttng/action/action.h
include/lttng/action/list.h
include/lttng/action/notify.h
include/lttng/action/path.h
include/lttng/action/rate-policy.h
include/lttng/action/rotate-session.h
include/lttng/action/snapshot-session.h
include/lttng/action/start-session.h
include/lttng/action/stop-session.h
include/lttng/channel.h
include/lttng/clear-handle.h
include/lttng/clear.h
include/lttng/condition/buffer-usage.h
include/lttng/condition/condition.h
include/lttng/condition/evaluation.h
include/lttng/condition/event-rule-matches.h
include/lttng/condition/session-consumed-size.h
include/lttng/condition/session-rotation.h
include/lttng/destruction-handle.h
include/lttng/domain.h
include/lttng/endpoint.h
include/lttng/error-query.h
include/lttng/event-expr.h
include/lttng/event-field-value.h
include/lttng/event-rule/event-rule.h
include/lttng/event-rule/jul-logging.h
include/lttng/event-rule/kernel-kprobe.h
include/lttng/event-rule/kernel-syscall.h
include/lttng/event-rule/kernel-tracepoint.h
include/lttng/event-rule/kernel-uprobe.h
include/lttng/event-rule/log4j-logging.h
include/lttng/event-rule/python-logging.h
include/lttng/event-rule/user-tracepoint.h
include/lttng/event.h
include/lttng/handle.h
include/lttng/health.h
include/lttng/kernel-probe.h
include/lttng/load.h
include/lttng/location.h
include/lttng/log-level-rule.h
include/lttng/lttng-error.h
include/lttng/lttng-export.h [new file with mode: 0644]
include/lttng/lttng.h
include/lttng/notification/channel.h
include/lttng/notification/notification.h
include/lttng/rotation.h
include/lttng/save.h
include/lttng/session-descriptor.h
include/lttng/session.h
include/lttng/snapshot.h
include/lttng/tracker.h
include/lttng/trigger/trigger.h
include/lttng/userspace-probe.h
src/bin/lttng-consumerd/lttng-consumerd.h
src/bin/lttng-sessiond/notification-thread.cpp
src/bin/lttng-sessiond/ust-sigbus.cpp
src/common/config/config-session-abi.h
src/common/config/session-config.c
src/common/consumer/consumer.h
src/common/error.h
src/common/filter/filter-lexer.l
src/common/filter/filter-symbols.h
src/common/hashtable/hashtable.h
src/common/index-allocator.h
src/common/lttng-elf.h
src/common/mi-lttng.c
src/common/mi-lttng.h
src/common/sessiond-comm/inet.h
src/common/spawn-viewer.h
src/common/ust-consumer/ust-consumer.c
src/lib/lttng-ctl/Makefile.am
src/lib/lttng-ctl/channel.c [deleted file]
src/lib/lttng-ctl/channel.cpp [new file with mode: 0644]
src/lib/lttng-ctl/clear.c [deleted file]
src/lib/lttng-ctl/clear.cpp [new file with mode: 0644]
src/lib/lttng-ctl/deprecated-symbols.c [deleted file]
src/lib/lttng-ctl/deprecated-symbols.cpp [new file with mode: 0644]
src/lib/lttng-ctl/destruction-handle.c [deleted file]
src/lib/lttng-ctl/destruction-handle.cpp [new file with mode: 0644]
src/lib/lttng-ctl/event.c [deleted file]
src/lib/lttng-ctl/event.cpp [new file with mode: 0644]
src/lib/lttng-ctl/load.c [deleted file]
src/lib/lttng-ctl/load.cpp [new file with mode: 0644]
src/lib/lttng-ctl/lttng-ctl-health.c [deleted file]
src/lib/lttng-ctl/lttng-ctl-health.cpp [new file with mode: 0644]
src/lib/lttng-ctl/lttng-ctl.c [deleted file]
src/lib/lttng-ctl/lttng-ctl.cpp [new file with mode: 0644]
src/lib/lttng-ctl/rotate.c [deleted file]
src/lib/lttng-ctl/rotate.cpp [new file with mode: 0644]
src/lib/lttng-ctl/save.c [deleted file]
src/lib/lttng-ctl/save.cpp [new file with mode: 0644]
src/lib/lttng-ctl/snapshot.c [deleted file]
src/lib/lttng-ctl/snapshot.cpp [new file with mode: 0644]
src/lib/lttng-ctl/tracker.c [deleted file]
src/lib/lttng-ctl/tracker.cpp [new file with mode: 0644]
tests/regression/tools/health/health_fail.c
tests/regression/tools/health/health_stall.c
tests/regression/tools/live/live_test.c
tests/regression/tools/notification/consumer_testpoints.c
tests/regression/tools/notification/sessiond_testpoints.c
tests/regression/ust/clock-override/lttng-ust-clock-override-test.c
tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c
tests/regression/ust/multi-lib/callsites.h
tests/regression/ust/ust-dl/libbar.h
tests/regression/ust/ust-dl/libfoo.h
tests/unit/test_kernel_data.cpp
tests/unit/test_ust_data.cpp
tests/unit/ust-sigbus.c
tests/utils/testapp/userspace-probe-elf-binary/foo.h

index e6b0d8e5a8814d81186f43751c2d508b2a78b09f..abb61d27fe42765898d38a6c832f1eb13d50a7cd 100644 (file)
@@ -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 += ...".
index 12c5f883c396caefccda7d936148e53827865c20..6fe724b3ae0ee0605f9d97aff4cc0ebe4f4c5761 100644 (file)
@@ -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 \
index cd3857d7222d7f1d8f780cbf473dce43e550c3da..70237e43cd772fea79b0b8ecea332820d3e2d5b5 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_H
 #define LTTNG_ACTION_H
 
+#include <lttng/lttng-export.h>
+
 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
 }
index ca871744d2eb01f8619e084f191662fee3a21238..9c23d60cacf4d9dc3ef5d3bba54658c52a403b9c 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_LIST_H
 #define LTTNG_ACTION_LIST_H
 
+#include <lttng/lttng-export.h>
+
 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);
 
index 08574753ff4a14026e506fd1e98c6e58d34de000..3aa55e09c8e5084cdce97a1a2f3980e9787dad76 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_NOTIFY_H
 #define LTTNG_ACTION_NOTIFY_H
 
+#include <lttng/lttng-export.h>
+
 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);
 
index 507b4ab49f6a66c889fd6e4f19dd42e5063a8b25..6ec91676b9e090f57a5688537a20dda537ec6409 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef LTTNG_ACTION_PATH_H
 #define LTTNG_ACTION_PATH_H
 
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 #include <stddef.h>
 
@@ -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
 }
index a3a288a28e715754675ebe7da5a2aae244623ef2..1cd0126e3dd52b6eeeaac3fccb94cf82d6a20dcd 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_RATE_POLICY_H
 
 #include <inttypes.h>
+#include <lttng/lttng-export.h>
 #include <sys/types.h>
 
 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
 }
index 7fbcce98c5f4deca0bf0b9fefebc64b128aa6da0..199b6f169a52eae8d852b92f47d53ee221e842c6 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_ROTATE_SESSION_H
 #define LTTNG_ACTION_ROTATE_SESSION_H
 
+#include <lttng/lttng-export.h>
+
 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);
 
index faa9b9fab8d8f56082e59946145647f0d047b530..8590862007f9dc4fe7d3861dfac444f079340c91 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_SNAPSHOT_SESSION_H
 #define LTTNG_ACTION_SNAPSHOT_SESSION_H
 
+#include <lttng/lttng-export.h>
+
 #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);
 
index c63a7d278bd6a93a8d28421de5bd17614056449c..db52000321c208481ba32cf2d45adbb11d82559a 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_START_SESSION_H
 #define LTTNG_ACTION_START_SESSION_H
 
+#include <lttng/lttng-export.h>
+
 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);
 
index dbe6819e67577e6dc8105b51a00771058b1440b4..5b223ef23fbfa846a893b5a266801388a8f87941 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ACTION_STOP_SESSION_H
 #define LTTNG_ACTION_STOP_SESSION_H
 
+#include <lttng/lttng-export.h>
+
 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);
 
index f3241ed30847af1886801ea728060a51ef2b2813..62e202d2659fb00ad49cc6b14113f36b2035b0a4 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/domain.h>
 #include <lttng/event.h>
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 
 #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
index 4d952ce3d133ba2442019251d5a14cac4bd2d8d3..e07e6c47f502a4991599d5a75887de4713d3d676 100644 (file)
@@ -10,6 +10,7 @@
 #define LTTNG_CLEAR_HANDLE_H
 
 #include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
 
 #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);
index b656db9f4d3ce8d0ccd024ec1ff3e26e7e52fc52..5dfd5db583caccef22f07d3e8869ae465c9a6f19 100644 (file)
@@ -10,6 +10,7 @@
 #define LTTNG_CLEAR_H
 
 #include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
 
 #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
 }
index 0bcf4c7a6f5cf9bd5e876ff51c405c66c703a9ce..dcdb7ca1f091c18ae47d68f1f8c29caed14076bb 100644 (file)
@@ -12,6 +12,7 @@
 #include <lttng/condition/condition.h>
 #include <stdint.h>
 #include <lttng/domain.h>
+#include <lttng/lttng-export.h>
 
 #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);
index 7aff1469b1dc8ae6eae6432df5cb577dc9e4ba7f..f0f5ffdd86cfc149035c6877612859c2a23a50dd 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_CONDITION_H
 #define LTTNG_CONDITION_H
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index 4ae1c62d9c09b1a0eabe864ba29724b9a72854ba..494cb9739be77bdb1515d2188ddf17e439f7081e 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_EVALUATION_H
 
 #include <lttng/condition/condition.h>
+#include <lttng/lttng-export.h>
 
 #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
 }
index 75d1c88af7e6c00b0cf0ce4217633b43bfa7db14..b1bbe08f3321015728783d190e1be34f027f744e 100644 (file)
@@ -11,6 +11,7 @@
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/condition/condition.h>
 #include <lttng/condition/evaluation.h>
+#include <lttng/lttng-export.h>
 
 #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);
 
index 24c9c54551774856a696ac282639f5d8045e6ed6..4d52cb68936bae93513d4ed98879e9aa36834481 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/condition/evaluation.h>
 #include <lttng/condition/condition.h>
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 
 #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);
index afd1bbf89760bd905b8e944b8f3e76d694369d0d..086fff915fd5ad0d225fd388afef403b81d7fcb9 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdint.h>
 #include <lttng/domain.h>
 #include <lttng/location.h>
+#include <lttng/lttng-export.h>
 
 #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);
index 6757f213a0ffe88fbd4c7eab63377654a2cca018..6fa4339ac921cb776864e1dd9fdf9a763012f494 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/rotation.h>
 #include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
 
 #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);
index ba62e0ec9487668674ea0fac51f8d83f6a1b1993..192c04bf239458c0621ae3ca9ae1dd9bfe8267f7 100644 (file)
@@ -13,6 +13,7 @@ extern "C" {
 #endif
 
 #include <lttng/constant.h>
+#include <lttng/lttng-export.h>
 
 /*
  * 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
index 1db5e5108ab8a994fad8a4372e8d4bced4c4708d..e27ac3b015b8b039c451dff6411fef20a2829b17 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_ENDPOINT_H
 #define LTTNG_ENDPOINT_H
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index ff0f0ae99ef06088e7706712665715d62f13dae9..a7cbae4210cb253e071e6fc0881bd0bce85357e8 100644 (file)
@@ -11,6 +11,7 @@
 #define LTTNG_ERROR_QUERY_H
 
 #include <lttng/lttng.h>
+#include <lttng/lttng-export.h>
 #include <lttng/trigger/trigger.h>
 #include <stdint.h>
 
@@ -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);
 
index 911648779c5872bb5a525032e6601362b689e578..cab22c97e96d40b7cd67700503f1ff7fab3ca77b 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef LTTNG_EVENT_EXPR_H
 #define LTTNG_EVENT_EXPR_H
 
+#include <lttng/lttng-export.h>
 #include <stdbool.h>
 
 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
 }
index 7fa851a79f04fd2f0038ef7e02d4bb14c6eaf563..02d93c66109d5cb834d27a0f2f9f0e14de3cab47 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef LTTNG_EVENT_FIELD_VALUE_H
 #define LTTNG_EVENT_FIELD_VALUE_H
 
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 
 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,
index a6dbb01a03268e4b37c4718b6e0766dea5d78141..0c2453ccfd772c13aab52d0c041ef4c8729ebcf7 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_EVENT_RULE_H
 #define LTTNG_EVENT_RULE_H
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index 943adde8aaa87bbbf68ad6dc2d5245605cc8cc8c..833e6adff7b84f101a545d74b2c2c03ada9c61dd 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
 #include <lttng/event.h>
 
 #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);
index 95f0002a3dd526959a782890c0179f1e83a6ab7c..c970116afebd19fa059e02066fe10c70711dee4e 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_EVENT_RULE_KERNEL_KPROBE_H
 
 #include <lttng/event-rule/event-rule.h>
+#include <lttng/lttng-export.h>
 
 #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
index 1db6915877440a8690dc34b88f4714244ac57125..ce8be6a5dd420b22fb73952e3cab3c36a4eae208 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_EVENT_RULE_KERNEL_SYSCALL_H
 
 #include <lttng/event-rule/event-rule.h>
+#include <lttng/lttng-export.h>
 
 #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);
 
index 84aa011e04c299ceb776c8d116df44d8ce0ae829..550a04ac492701dd9385f547900adad394ddda42 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/event.h>
+#include <lttng/lttng-export.h>
 
 #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
index 06712df3213a3757edd0771855cc40b4afbcec63..6b29b695d4291f2b22677de33b4088959fa0b58b 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_EVENT_RULE_KERNEL_UPROBE_H
 
 #include <lttng/event-rule/event-rule.h>
+#include <lttng/lttng-export.h>
 #include <lttng/userspace-probe.h>
 
 #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
index 1514a06f0411ff688df525839d11d077a719e3fd..277e7d95019059b9723f009d875757e8ab17ed02 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
 #include <lttng/event.h>
 
 #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);
index cb1f7a985940b94888e250a2d47b945b0f116c5a..d4a6ada472b28d1a6ed012ac89bdaba9ca506632 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
 #include <lttng/event.h>
 
 #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);
index 8744d3594307e39251bd05725603a376ce0bbccb..7ee91ce79c15c5bdcfb2305a2689e108d676e24c 100644 (file)
@@ -11,6 +11,7 @@
 #include <lttng/domain.h>
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
 #include <lttng/event.h>
 
 #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,
index 12d0ecc68beedc31ccaaf03e4c3c5d39b57b64c2..5915db6d6738632d126ad2b0369f78d84256e215 100644 (file)
@@ -9,13 +9,14 @@
 #ifndef LTTNG_EVENT_H
 #define LTTNG_EVENT_H
 
+#include <lttng/handle.h>
+#include <lttng/lttng-export.h>
+#include <lttng/userspace-probe.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <lttng/handle.h>
-#include <lttng/userspace-probe.h>
-
 /*
  * 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);
 
index 10ec82c62f604c6d7bef5a2fdc3fa9502b5e8589..efc889f1d62ba89b2b6785113d562b6e1d9e6415 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_HANDLE_H
 
 #include <lttng/domain.h>
+#include <lttng/lttng-export.h>
 
 #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
index 0256cbea86468b93e14d2828cbb88b5c7097d1e9..26e88570542777ea16deae79f46bdd0041fbd316 100644 (file)
@@ -9,6 +9,8 @@
  *
  */
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index 4536fd5ef82317fac5dd36164cce9f802ee4d037..cdd617dea12625296435615fa72f778f3ff84938 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef LTTNG_KERNEL_PROBE_H
 #define LTTNG_KERNEL_PROBE_H
 
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 
 #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);
index ea541e45bdc4fac49d6a764abac00569dc34f92a..0395bb4145acfea3923abeca700eaf3c062aa527 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef LTTNG_LOAD_H
 #define LTTNG_LOAD_H
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index d875b2484c4795b3e6986a37195580791d17bf09..ce686315effe4ffa1149d7344cb85c4dcfca60fd 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef LTTNG_LOCATION_H
 #define LTTNG_LOCATION_H
 
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 
 #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);
index ea9045d56d442069bd761c6b62766156e21edef5..ddb3501a1a66f4e2bfe49577ef32c9f298f7f4da 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_LOG_LEVEL_RULE_H
 #define LTTNG_LOG_LEVEL_RULE_H
 
+#include <lttng/lttng-export.h>
+
 #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
index aadf2f45ba9aaf8cd42a6fc7385b31dd8ca4c8bb..790a78a0b60e88188486fc230b84c01ba031f347 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef LTTNG_ERROR_H
 #define LTTNG_ERROR_H
 
+#include <lttng/lttng-export.h>
+
 #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 (file)
index 0000000..ae3990a
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2021 Simon Marchi <simon.marchi@efficios.com>
+ *
+ * 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
index efbd92f5dc404b49f3a2aad80c9c3386da0ba10a..825b6682bbee9f39cbaaf2c0093cc1ba3984cdca 100644 (file)
@@ -58,6 +58,7 @@
 #include <lttng/location.h>
 #include <lttng/log-level-rule.h>
 #include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
 #include <lttng/notification/channel.h>
 #include <lttng/notification/notification.h>
 #include <lttng/rotation.h>
@@ -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
 }
index 95a048fb9da1dca06ca32dfaa59cb9b597eb58e2..030c88cbd3e1829ee1db2bd34fb2dc6bf43e3d4a 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef LTTNG_NOTIFICATION_CHANNEL_H
 #define LTTNG_NOTIFICATION_CHANNEL_H
 
+#include <lttng/lttng-export.h>
 #include <stdbool.h>
 
 #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
index 69e17d30c016fe0ea8363b01eaa5e84e941b2eac..d1c088fecc8973fc5f9bcabfca8df065e4b6793c 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_NOTIFICATION_H
 #define LTTNG_NOTIFICATION_H
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index 316f2cdb52c5700e5dd42dd409d910cbd98f04f5..08f2a985be806ae26284b124486c9bc5c8e91775 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <stdint.h>
 #include <lttng/location.h>
+#include <lttng/lttng-export.h>
 
 #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);
 
index 7dbe32698f83736c2870a86e1866d3f7c513715e..d28fdffcdc062c4b77596f7f5ed0e2e931a72de0 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_SAVE_H
 #define LTTNG_SAVE_H
 
+#include <lttng/lttng-export.h>
+
 #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
 }
index 3fb28a78e7da0cc205c75082c09bda7ec9d00501..5db04be7e9a959aa7935692e4481f9f3e1d19d03 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_SESSION_DESCRIPTOR_H
 #define LTTNG_SESSION_DESCRIPTOR_H
 
+#include <lttng/lttng-export.h>
+
 #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
index f13f83916a0c45f38a1d515a6100dd92046a1256..153a37b03680da361e97f0f64bdee979ae16c6fe 100644 (file)
@@ -14,6 +14,7 @@ extern "C" {
 #endif
 
 #include <lttng/constant.h>
+#include <lttng/lttng-export.h>
 
 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
index bdbfb094f42a3aa4dc8024e409577e3f058bdb70..b777e006b2f131e95f7508fec428d8c52f0476a3 100644 (file)
@@ -9,6 +9,7 @@
 #define LTTNG_SNAPSHOT_H
 
 #include <limits.h>
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 #include <sys/types.h>
 
@@ -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
index fa91abab6225c98c032043e14151c2bf1d310e2f..869f8a8f85b0bf7b1e1e39ee71298f23d732287c 100644 (file)
@@ -12,6 +12,7 @@
 #include <lttng/constant.h>
 #include <lttng/domain.h>
 #include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
 #include <lttng/session.h>
 
 #include <sys/types.h>
@@ -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
 }
index 842203ace0f145f17ecbee0389762671acbeea83..0a944a15af197d4fe2870e99f496531296b1e177 100644 (file)
@@ -12,6 +12,7 @@
 #include <lttng/constant.h>
 #include <inttypes.h>
 #include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
 
 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
 }
index 5a6fa51a0318d8d1cf07e30d36692ea463bb1ab2..b6fc13508a3c02f48db57c7596cfa915d0bf150e 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef LTTNG_USERSPACE_PROBE_H
 #define LTTNG_USERSPACE_PROBE_H
 
+#include <lttng/lttng-export.h>
+
 #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
index 7621877d3563e1f838daa9f38396b62b88559022..354f7f3fa88b4d182cedada8dabe4e71d2a79783 100644 (file)
@@ -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 */
index e8a2adec9871eb07d68a37010bb479f8602a31c2..867fc7c044c679d658c331c3c94420bd8b1bf2e2 100644 (file)
 #include <urcu/list.h>
 #include <urcu/rculfhash.h>
 
+/*
+ * 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.
  */
index 52a7ac2703371e957adb43902d9845dfa7a293f6..93a974eb30a34b22343f487385c7b931aa80b8cf 100644 (file)
@@ -7,9 +7,10 @@
 
 #include <lttng/ust-sigbus.h>
 #include <lttng/ust-ctl.h>
+#include <lttng/lttng-export.h>
 #include "ust-sigbus.h"
 
-DEFINE_LTTNG_UST_SIGBUS_STATE();
+LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE();
 
 void lttng_ust_handle_sigbus(void *address)
 {
index 75ff303d49a818dbf34f0b489bee520d97cb3255..6c903ef7a4911751849e6a4dd8e3cd9bcc4cc32e 100644 (file)
@@ -8,23 +8,25 @@
 #ifndef CONFIG_SESSION_INTERNAL_H
 #define CONFIG_SESSION_INTERNAL_H
 
+#include <lttng/lttng-export.h>
+
 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;
index cf785c8b52a36d2033d12ed01289631e50bb2791..08d66851b45b07909c183f51c7a5018626879ed7 100644 (file)
@@ -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,
index 6f2aae31b3f582c91ebe4e0d30bb8a0d2014c4f6..1b0ee000b5bdd944ac4aba946a83d256327a5195 100644 (file)
@@ -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
index 6660cee6adec9f765d8802bacfe80db44e67f954..8bb0de15cfa70f0c621bae207932274903a65c70 100644 (file)
@@ -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;
index cdb099af7552477129aa16adef47ff51f66cdea8..9da4645e5e266c621009be16f60b983c59cf7574 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include "filter-ast.h"
 #include "filter-parser.h"
+#include <lttng/lttng-export.h>
 
 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);
+}
index 031776da063345410d95f3bdeaa1dbdcf27fa4a2..27aaada54cba315f49aedd12226e220fecc3d21e 100644 (file)
  *
  */
 
-#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 */
index e2dae968d0040de1136f40a689018099eb2fc538..cefd43833b721604487d12e71a1a36280c7f3e30 100644 (file)
 #include <stdint.h>
 
 #include <common/macros.h>
+#include <lttng/lttng-export.h>
 #include <urcu/rculfhash.h>
 
 #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;
index 9dbd745e6bdaf52ef1ccebae2dffd7c3b1308e82..93ab5ddd5e1483cd268e1129d5565c5d70cdb1e6 100644 (file)
@@ -9,6 +9,7 @@
 #define _COMMON_INDEX_ALLOCATOR_H
 
 #include <inttypes.h>
+#include <lttng/lttng-export.h>
 
 #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
 }
index 49b064ce54b61e129ab253dccaec97900427e758..524b8784605462a897a30fe75eba05f4799bc4a4 100644 (file)
@@ -8,9 +8,11 @@
  *
  */
 
-int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset);
+#include <lttng/lttng-export.h>
 
-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 */
index b790f793afba832272edc1461de6f6a1c78fcf60..1ff9f936c0cb160c55c49469b7e7f1ef9c32e7cc 100644 (file)
@@ -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
index 2f27bf6cd52a37e4c8c2fdf8cb08f2d02cd118e4..74ae502f5be023941a939f7a3a0fe8571f72246a 100644 (file)
@@ -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;
 
index 5c0828b2b3246c6ea9518474378f34378e4a08b6..9aec36cf13c4e1b7650147b71ac22f921028e3e0 100644 (file)
@@ -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;
index 316fe19982372e0d64e6fc33c7aedbe10fa77347..dc7b7bbcbb0340484c434d8aaa5f77add805bb1c 100644 (file)
@@ -8,6 +8,7 @@
  *
  */
 
+#include <lttng/lttng-export.h>
 #include <stdbool.h>
 
 #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)
 }
index 31effcc234d9f2168cca2ba82ab1cbcd3f4dcc68..310b670b15ed4194904c0a7d5f95802c4df0f7e3 100644 (file)
@@ -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
index e1ffd6a48cf74adb116727fef6b61fecb8a811b0..b31e5bd6f819e79f6b45caa10a659bfe37de4a8a 100644 (file)
@@ -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.c
deleted file mode 100644 (file)
index 17f9537..0000000
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- */
-
-#include <lttng/notification/notification-internal.h>
-#include <lttng/notification/channel-internal.h>
-#include <lttng/condition/condition-internal.h>
-#include <lttng/endpoint.h>
-#include <common/defaults.h>
-#include <common/error.h>
-#include <common/dynamic-buffer.h>
-#include <common/utils.h>
-#include <common/defaults.h>
-#include <common/payload.h>
-#include <common/payload-view.h>
-#include <common/unix.h>
-#include "lttng-ctl-helper.h"
-#include <common/compat/poll.h>
-
-static
-int handshake(struct lttng_notification_channel *channel);
-
-/*
- * Populates the reception buffer with the next complete message.
- * The caller must acquire the channel's lock.
- */
-static
-int receive_message(struct lttng_notification_channel *channel)
-{
-       ssize_t ret;
-       struct lttng_notification_channel_message msg;
-
-       lttng_payload_clear(&channel->reception_payload);
-
-       ret = lttcomm_recv_unix_sock(channel->socket, &msg, sizeof(msg));
-       if (ret <= 0) {
-               ret = -1;
-               goto error;
-       }
-
-       if (msg.size > DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE) {
-               ret = -1;
-               goto error;
-       }
-
-       /* Add message header at buffer's start. */
-       ret = lttng_dynamic_buffer_append(&channel->reception_payload.buffer, &msg,
-                       sizeof(msg));
-       if (ret) {
-               goto error;
-       }
-
-       /* Reserve space for the payload. */
-       ret = lttng_dynamic_buffer_set_size(&channel->reception_payload.buffer,
-                       channel->reception_payload.buffer.size + msg.size);
-       if (ret) {
-               goto error;
-       }
-
-       /* Receive message payload. */
-       ret = lttcomm_recv_unix_sock(channel->socket,
-                       channel->reception_payload.buffer.data + sizeof(msg), msg.size);
-       if (ret < (ssize_t) msg.size) {
-               ret = -1;
-               goto error;
-       }
-
-       /* Receive message fds. */
-       if (msg.fds != 0) {
-               ret = lttcomm_recv_payload_fds_unix_sock(channel->socket,
-                               msg.fds, &channel->reception_payload);
-               if (ret < sizeof(int) * msg.fds) {
-                       ret = -1;
-                       goto error;
-               }
-       }
-       ret = 0;
-end:
-       return ret;
-error:
-       lttng_payload_clear(&channel->reception_payload);
-       goto end;
-}
-
-static
-enum lttng_notification_channel_message_type get_current_message_type(
-               struct lttng_notification_channel *channel)
-{
-       struct lttng_notification_channel_message *msg;
-
-       LTTNG_ASSERT(channel->reception_payload.buffer.size >= sizeof(*msg));
-
-       msg = (struct lttng_notification_channel_message *)
-                       channel->reception_payload.buffer.data;
-       return (enum lttng_notification_channel_message_type) msg->type;
-}
-
-static
-struct lttng_notification *create_notification_from_current_message(
-               struct lttng_notification_channel *channel)
-{
-       ssize_t ret;
-       struct lttng_notification *notification = NULL;
-
-       if (channel->reception_payload.buffer.size <=
-                       sizeof(struct lttng_notification_channel_message)) {
-               goto end;
-       }
-
-       {
-               struct lttng_payload_view view = lttng_payload_view_from_payload(
-                               &channel->reception_payload,
-                               sizeof(struct lttng_notification_channel_message),
-                               -1);
-
-               ret = lttng_notification_create_from_payload(
-                               &view, &notification);
-       }
-
-       if (ret != channel->reception_payload.buffer.size -
-                       sizeof(struct lttng_notification_channel_message)) {
-               lttng_notification_destroy(notification);
-               notification = NULL;
-               goto end;
-       }
-end:
-       return notification;
-}
-
-struct lttng_notification_channel *lttng_notification_channel_create(
-               struct lttng_endpoint *endpoint)
-{
-       int fd, ret;
-       bool is_in_tracing_group = false, is_root = false;
-       char *sock_path = NULL;
-       struct lttng_notification_channel *channel = NULL;
-
-       if (!endpoint ||
-                       endpoint != lttng_session_daemon_notification_endpoint) {
-               goto end;
-       }
-
-       sock_path = zmalloc(LTTNG_PATH_MAX);
-       if (!sock_path) {
-               goto end;
-       }
-
-       channel = zmalloc(sizeof(struct lttng_notification_channel));
-       if (!channel) {
-               goto end;
-       }
-       channel->socket = -1;
-       pthread_mutex_init(&channel->lock, NULL);
-       lttng_payload_init(&channel->reception_payload);
-       CDS_INIT_LIST_HEAD(&channel->pending_notifications.list);
-
-       is_root = (getuid() == 0);
-       if (!is_root) {
-               is_in_tracing_group = lttng_check_tracing_group();
-       }
-
-       if (is_root || is_in_tracing_group) {
-               ret = lttng_strncpy(sock_path,
-                               DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK,
-                               LTTNG_PATH_MAX);
-               if (ret) {
-                       ret = -LTTNG_ERR_INVALID;
-                       goto error;
-               }
-
-               ret = lttcomm_connect_unix_sock(sock_path);
-               if (ret >= 0) {
-                       fd = ret;
-                       goto set_fd;
-               }
-       }
-
-       /* Fallback to local session daemon. */
-       ret = snprintf(sock_path, LTTNG_PATH_MAX,
-                       DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK,
-                       utils_get_home_dir());
-       if (ret < 0 || ret >= LTTNG_PATH_MAX) {
-               goto error;
-       }
-
-       ret = lttcomm_connect_unix_sock(sock_path);
-       if (ret < 0) {
-               goto error;
-       }
-       fd = ret;
-
-set_fd:
-       channel->socket = fd;
-
-       ret = handshake(channel);
-       if (ret) {
-               goto error;
-       }
-end:
-       free(sock_path);
-       return channel;
-error:
-       lttng_notification_channel_destroy(channel);
-       channel = NULL;
-       goto end;
-}
-
-enum lttng_notification_channel_status
-lttng_notification_channel_get_next_notification(
-               struct lttng_notification_channel *channel,
-               struct lttng_notification **_notification)
-{
-       int ret;
-       struct lttng_notification *notification = NULL;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
-       struct lttng_poll_event events;
-
-       if (!channel || !_notification) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
-               goto end;
-       }
-
-       pthread_mutex_lock(&channel->lock);
-
-       if (channel->pending_notifications.count) {
-               struct pending_notification *pending_notification;
-
-               LTTNG_ASSERT(!cds_list_empty(&channel->pending_notifications.list));
-
-               /* Deliver one of the pending notifications. */
-               pending_notification = cds_list_first_entry(
-                               &channel->pending_notifications.list,
-                               struct pending_notification,
-                               node);
-               notification = pending_notification->notification;
-               if (!notification) {
-                       status = LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED;
-               }
-               cds_list_del(&pending_notification->node);
-               channel->pending_notifications.count--;
-               free(pending_notification);
-               goto end_unlock;
-       }
-
-       /*
-        * Block on interruptible epoll/poll() instead of the message reception
-        * itself as the recvmsg() wrappers always restart on EINTR. We choose
-        * to wait using interruptible epoll/poll() in order to:
-        *   1) Return if a signal occurs,
-        *   2) Not deal with partially received messages.
-        *
-        * The drawback to this approach is that we assume that messages
-        * are complete/well formed. If a message is shorter than its
-        * announced length, receive_message() will block on recvmsg()
-        * and never return (even if a signal is received).
-        */
-       ret = lttng_poll_create(&events, 1, LTTNG_CLOEXEC);
-       if (ret < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_unlock;
-       }
-       ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
-       if (ret < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-       ret = lttng_poll_wait_interruptible(&events, -1);
-       if (ret <= 0) {
-               status = (ret == -1 && errno == EINTR) ?
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED :
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-
-       ret = receive_message(channel);
-       if (ret) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-
-       switch (get_current_message_type(channel)) {
-       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
-               notification = create_notification_from_current_message(
-                               channel);
-               if (!notification) {
-                       status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-                       goto end_clean_poll;
-               }
-               break;
-       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED:
-               /* No payload to consume. */
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED;
-               break;
-       default:
-               /* Protocol error. */
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-
-end_clean_poll:
-       lttng_poll_clean(&events);
-end_unlock:
-       pthread_mutex_unlock(&channel->lock);
-       *_notification = notification;
-end:
-       return status;
-}
-
-static
-int enqueue_dropped_notification(
-               struct lttng_notification_channel *channel)
-{
-       int ret = 0;
-       struct pending_notification *pending_notification;
-       struct cds_list_head *last_element =
-                       channel->pending_notifications.list.prev;
-
-       pending_notification = caa_container_of(last_element,
-                       struct pending_notification, node);
-       if (!pending_notification->notification) {
-               /*
-                * The last enqueued notification indicates dropped
-                * notifications; there is nothing to do as we group
-                * dropped notifications together.
-                */
-               goto end;
-       }
-
-       if (channel->pending_notifications.count >=
-                       DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT &&
-                       pending_notification->notification) {
-               /*
-                * Discard the last enqueued notification to indicate
-                * that notifications were dropped at this point.
-                */
-               lttng_notification_destroy(
-                               pending_notification->notification);
-               pending_notification->notification = NULL;
-               goto end;
-       }
-
-       pending_notification = zmalloc(sizeof(*pending_notification));
-       if (!pending_notification) {
-               ret = -1;
-               goto end;
-       }
-       CDS_INIT_LIST_HEAD(&pending_notification->node);
-       cds_list_add(&pending_notification->node,
-                       &channel->pending_notifications.list);
-       channel->pending_notifications.count++;
-end:
-       return ret;
-}
-
-static
-int enqueue_notification_from_current_message(
-               struct lttng_notification_channel *channel)
-{
-       int ret = 0;
-       struct lttng_notification *notification;
-       struct pending_notification *pending_notification;
-
-       if (channel->pending_notifications.count >=
-                       DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT) {
-               /* Drop the notification. */
-               ret = enqueue_dropped_notification(channel);
-               goto end;
-       }
-
-       pending_notification = zmalloc(sizeof(*pending_notification));
-       if (!pending_notification) {
-               ret = -1;
-               goto error;
-       }
-       CDS_INIT_LIST_HEAD(&pending_notification->node);
-
-       notification = create_notification_from_current_message(channel);
-       if (!notification) {
-               ret = -1;
-               goto error;
-       }
-
-       pending_notification->notification = notification;
-       cds_list_add(&pending_notification->node,
-                       &channel->pending_notifications.list);
-       channel->pending_notifications.count++;
-end:
-       return ret;
-error:
-       free(pending_notification);
-       goto end;
-}
-
-enum lttng_notification_channel_status
-lttng_notification_channel_has_pending_notification(
-               struct lttng_notification_channel *channel,
-               bool *_notification_pending)
-{
-       int ret;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
-       struct lttng_poll_event events;
-
-       if (!channel || !_notification_pending) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
-               goto end;
-       }
-
-       pthread_mutex_lock(&channel->lock);
-
-       if (channel->pending_notifications.count) {
-               *_notification_pending = true;
-               goto end_unlock;
-       }
-
-       if (channel->socket < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED;
-               goto end_unlock;
-       }
-
-       /*
-        * Check, without blocking, if data is available on the channel's
-        * socket. If there is data available, it is safe to read (blocking)
-        * on the socket for a message from the session daemon.
-        *
-        * Since all commands wait for the session daemon's reply before
-        * releasing the channel's lock, the protocol only allows for
-        * notifications and "notification dropped" messages to come
-        * through. If we receive a different message type, it is
-        * considered a protocol error.
-        *
-        * Note that this function is not guaranteed not to block. This
-        * will block until our peer (the session daemon) has sent a complete
-        * message if we see data available on the socket. If the peer does
-        * not respect the protocol, this may block indefinitely.
-        */
-       ret = lttng_poll_create(&events, 1, LTTNG_CLOEXEC);
-       if (ret < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_unlock;
-       }
-       ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
-       if (ret < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-       /* timeout = 0: return immediately. */
-       ret = lttng_poll_wait_interruptible(&events, 0);
-       if (ret == 0) {
-               /* No data available. */
-               *_notification_pending = false;
-               goto end_clean_poll;
-       } else if (ret < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-
-       /* Data available on socket. */
-       ret = receive_message(channel);
-       if (ret) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-
-       switch (get_current_message_type(channel)) {
-       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
-               ret = enqueue_notification_from_current_message(channel);
-               if (ret) {
-                       goto end_clean_poll;
-               }
-               *_notification_pending = true;
-               break;
-       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED:
-               ret = enqueue_dropped_notification(channel);
-               if (ret) {
-                       goto end_clean_poll;
-               }
-               *_notification_pending = true;
-               break;
-       default:
-               /* Protocol error. */
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_clean_poll;
-       }
-
-end_clean_poll:
-       lttng_poll_clean(&events);
-end_unlock:
-       pthread_mutex_unlock(&channel->lock);
-end:
-       return status;
-}
-
-static
-int receive_command_reply(struct lttng_notification_channel *channel,
-               enum lttng_notification_channel_status *status)
-{
-       int ret;
-       struct lttng_notification_channel_command_reply *reply;
-
-       while (true) {
-               enum lttng_notification_channel_message_type msg_type;
-
-               ret = receive_message(channel);
-               if (ret) {
-                       goto end;
-               }
-
-               msg_type = get_current_message_type(channel);
-               switch (msg_type) {
-               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_COMMAND_REPLY:
-                       goto exit_loop;
-               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
-                       ret = enqueue_notification_from_current_message(
-                                       channel);
-                       if (ret) {
-                               goto end;
-                       }
-                       break;
-               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED:
-                       ret = enqueue_dropped_notification(channel);
-                       if (ret) {
-                               goto end;
-                       }
-                       break;
-               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE:
-               {
-                       struct lttng_notification_channel_command_handshake *handshake;
-
-                       handshake = (struct lttng_notification_channel_command_handshake *)
-                                       (channel->reception_payload.buffer.data +
-                                       sizeof(struct lttng_notification_channel_message));
-                       channel->version.major = handshake->major;
-                       channel->version.minor = handshake->minor;
-                       channel->version.set = true;
-                       break;
-               }
-               default:
-                       ret = -1;
-                       goto end;
-               }
-       }
-
-exit_loop:
-       if (channel->reception_payload.buffer.size <
-                       (sizeof(struct lttng_notification_channel_message) +
-                       sizeof(*reply))) {
-               /* Invalid message received. */
-               ret = -1;
-               goto end;
-       }
-
-       reply = (struct lttng_notification_channel_command_reply *)
-                       (channel->reception_payload.buffer.data +
-                       sizeof(struct lttng_notification_channel_message));
-       *status = (enum lttng_notification_channel_status) reply->status;
-end:
-       return ret;
-}
-
-static
-int handshake(struct lttng_notification_channel *channel)
-{
-       ssize_t ret;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
-       struct lttng_notification_channel_command_handshake handshake = {
-               .major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
-               .minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
-       };
-       struct lttng_notification_channel_message msg_header = {
-               .type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE,
-               .size = sizeof(handshake),
-       };
-       char send_buffer[sizeof(msg_header) + sizeof(handshake)];
-
-       memcpy(send_buffer, &msg_header, sizeof(msg_header));
-       memcpy(send_buffer + sizeof(msg_header), &handshake, sizeof(handshake));
-
-       pthread_mutex_lock(&channel->lock);
-
-       ret = lttcomm_send_creds_unix_sock(channel->socket, send_buffer,
-                       sizeof(send_buffer));
-       if (ret < 0) {
-               goto end_unlock;
-       }
-
-       /* Receive handshake info from the sessiond. */
-       ret = receive_command_reply(channel, &status);
-       if (ret < 0) {
-               goto end_unlock;
-       }
-
-       if (!channel->version.set) {
-               ret = -1;
-               goto end_unlock;
-       }
-
-       if (channel->version.major != LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR) {
-               ret = -1;
-               goto end_unlock;
-       }
-
-end_unlock:
-       pthread_mutex_unlock(&channel->lock);
-       return ret;
-}
-
-static
-enum lttng_notification_channel_status send_condition_command(
-               struct lttng_notification_channel *channel,
-               enum lttng_notification_channel_message_type type,
-               const struct lttng_condition *condition)
-{
-       int socket;
-       ssize_t ret;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
-       struct lttng_payload payload;
-       struct lttng_notification_channel_message cmd_header = {
-               .type = (int8_t) type,
-       };
-
-       lttng_payload_init(&payload);
-
-       if (!channel) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
-               goto end;
-       }
-
-       LTTNG_ASSERT(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE ||
-               type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE);
-
-       pthread_mutex_lock(&channel->lock);
-       socket = channel->socket;
-
-       if (!lttng_condition_validate(condition)) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
-               goto end_unlock;
-       }
-
-       ret = lttng_dynamic_buffer_append(&payload.buffer, &cmd_header,
-                       sizeof(cmd_header));
-       if (ret) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_unlock;
-       }
-
-       ret = lttng_condition_serialize(condition, &payload);
-       if (ret) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
-               goto end_unlock;
-       }
-
-       /* Update payload length. */
-       ((struct lttng_notification_channel_message *) payload.buffer.data)->size =
-                       (uint32_t) (payload.buffer.size - sizeof(cmd_header));
-
-       {
-               struct lttng_payload_view pv =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               const int fd_count =
-                               lttng_payload_view_get_fd_handle_count(&pv);
-
-               /* Update fd count. */
-               ((struct lttng_notification_channel_message *) payload.buffer.data)->fds =
-                       (uint32_t) fd_count;
-
-               ret = lttcomm_send_unix_sock(
-                       socket, pv.buffer.data, pv.buffer.size);
-               if (ret < 0) {
-                       status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-                       goto end_unlock;
-               }
-
-               /* Pass fds if present. */
-               if (fd_count > 0) {
-                       ret = lttcomm_send_payload_view_fds_unix_sock(socket,
-                                       &pv);
-                       if (ret < 0) {
-                               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-                               goto end_unlock;
-                       }
-               }
-       }
-
-       ret = receive_command_reply(channel, &status);
-       if (ret < 0) {
-               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
-               goto end_unlock;
-       }
-end_unlock:
-       pthread_mutex_unlock(&channel->lock);
-end:
-       lttng_payload_reset(&payload);
-       return status;
-}
-
-enum lttng_notification_channel_status lttng_notification_channel_subscribe(
-               struct lttng_notification_channel *channel,
-               const struct lttng_condition *condition)
-{
-       return send_condition_command(channel,
-                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE,
-                       condition);
-}
-
-enum lttng_notification_channel_status lttng_notification_channel_unsubscribe(
-               struct lttng_notification_channel *channel,
-               const struct lttng_condition *condition)
-{
-       return send_condition_command(channel,
-                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE,
-                       condition);
-}
-
-void lttng_notification_channel_destroy(
-               struct lttng_notification_channel *channel)
-{
-       if (!channel) {
-               return;
-       }
-
-       if (channel->socket >= 0) {
-               (void) lttcomm_close_unix_sock(channel->socket);
-       }
-       pthread_mutex_destroy(&channel->lock);
-       lttng_payload_reset(&channel->reception_payload);
-       free(channel);
-}
diff --git a/src/lib/lttng-ctl/channel.cpp b/src/lib/lttng-ctl/channel.cpp
new file mode 100644 (file)
index 0000000..e7b044a
--- /dev/null
@@ -0,0 +1,735 @@
+/*
+ * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ */
+
+#include <lttng/notification/notification-internal.h>
+#include <lttng/notification/channel-internal.h>
+#include <lttng/condition/condition-internal.h>
+#include <lttng/endpoint.h>
+#include <common/defaults.h>
+#include <common/error.h>
+#include <common/dynamic-buffer.h>
+#include <common/utils.h>
+#include <common/defaults.h>
+#include <common/payload.h>
+#include <common/payload-view.h>
+#include <common/unix.h>
+#include "lttng-ctl-helper.h"
+#include <common/compat/poll.h>
+
+static
+int handshake(struct lttng_notification_channel *channel);
+
+/*
+ * Populates the reception buffer with the next complete message.
+ * The caller must acquire the channel's lock.
+ */
+static
+int receive_message(struct lttng_notification_channel *channel)
+{
+       ssize_t ret;
+       struct lttng_notification_channel_message msg;
+
+       lttng_payload_clear(&channel->reception_payload);
+
+       ret = lttcomm_recv_unix_sock(channel->socket, &msg, sizeof(msg));
+       if (ret <= 0) {
+               ret = -1;
+               goto error;
+       }
+
+       if (msg.size > DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE) {
+               ret = -1;
+               goto error;
+       }
+
+       /* Add message header at buffer's start. */
+       ret = lttng_dynamic_buffer_append(&channel->reception_payload.buffer, &msg,
+                       sizeof(msg));
+       if (ret) {
+               goto error;
+       }
+
+       /* Reserve space for the payload. */
+       ret = lttng_dynamic_buffer_set_size(&channel->reception_payload.buffer,
+                       channel->reception_payload.buffer.size + msg.size);
+       if (ret) {
+               goto error;
+       }
+
+       /* Receive message payload. */
+       ret = lttcomm_recv_unix_sock(channel->socket,
+                       channel->reception_payload.buffer.data + sizeof(msg), msg.size);
+       if (ret < (ssize_t) msg.size) {
+               ret = -1;
+               goto error;
+       }
+
+       /* Receive message fds. */
+       if (msg.fds != 0) {
+               ret = lttcomm_recv_payload_fds_unix_sock(channel->socket,
+                               msg.fds, &channel->reception_payload);
+               if (ret < sizeof(int) * msg.fds) {
+                       ret = -1;
+                       goto error;
+               }
+       }
+       ret = 0;
+end:
+       return ret;
+error:
+       lttng_payload_clear(&channel->reception_payload);
+       goto end;
+}
+
+static
+enum lttng_notification_channel_message_type get_current_message_type(
+               struct lttng_notification_channel *channel)
+{
+       struct lttng_notification_channel_message *msg;
+
+       LTTNG_ASSERT(channel->reception_payload.buffer.size >= sizeof(*msg));
+
+       msg = (struct lttng_notification_channel_message *)
+                       channel->reception_payload.buffer.data;
+       return (enum lttng_notification_channel_message_type) msg->type;
+}
+
+static
+struct lttng_notification *create_notification_from_current_message(
+               struct lttng_notification_channel *channel)
+{
+       ssize_t ret;
+       struct lttng_notification *notification = NULL;
+
+       if (channel->reception_payload.buffer.size <=
+                       sizeof(struct lttng_notification_channel_message)) {
+               goto end;
+       }
+
+       {
+               struct lttng_payload_view view = lttng_payload_view_from_payload(
+                               &channel->reception_payload,
+                               sizeof(struct lttng_notification_channel_message),
+                               -1);
+
+               ret = lttng_notification_create_from_payload(
+                               &view, &notification);
+       }
+
+       if (ret != channel->reception_payload.buffer.size -
+                       sizeof(struct lttng_notification_channel_message)) {
+               lttng_notification_destroy(notification);
+               notification = NULL;
+               goto end;
+       }
+end:
+       return notification;
+}
+
+struct lttng_notification_channel *lttng_notification_channel_create(
+               struct lttng_endpoint *endpoint)
+{
+       int fd, ret;
+       bool is_in_tracing_group = false, is_root = false;
+       char *sock_path = NULL;
+       struct lttng_notification_channel *channel = NULL;
+
+       if (!endpoint ||
+                       endpoint != lttng_session_daemon_notification_endpoint) {
+               goto end;
+       }
+
+       sock_path = (char *) zmalloc(LTTNG_PATH_MAX);
+       if (!sock_path) {
+               goto end;
+       }
+
+       channel = (lttng_notification_channel *) zmalloc(sizeof(struct lttng_notification_channel));
+       if (!channel) {
+               goto end;
+       }
+       channel->socket = -1;
+       pthread_mutex_init(&channel->lock, NULL);
+       lttng_payload_init(&channel->reception_payload);
+       CDS_INIT_LIST_HEAD(&channel->pending_notifications.list);
+
+       is_root = (getuid() == 0);
+       if (!is_root) {
+               is_in_tracing_group = lttng_check_tracing_group();
+       }
+
+       if (is_root || is_in_tracing_group) {
+               ret = lttng_strncpy(sock_path,
+                               DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK,
+                               LTTNG_PATH_MAX);
+               if (ret) {
+                       ret = -LTTNG_ERR_INVALID;
+                       goto error;
+               }
+
+               ret = lttcomm_connect_unix_sock(sock_path);
+               if (ret >= 0) {
+                       fd = ret;
+                       goto set_fd;
+               }
+       }
+
+       /* Fallback to local session daemon. */
+       ret = snprintf(sock_path, LTTNG_PATH_MAX,
+                       DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK,
+                       utils_get_home_dir());
+       if (ret < 0 || ret >= LTTNG_PATH_MAX) {
+               goto error;
+       }
+
+       ret = lttcomm_connect_unix_sock(sock_path);
+       if (ret < 0) {
+               goto error;
+       }
+       fd = ret;
+
+set_fd:
+       channel->socket = fd;
+
+       ret = handshake(channel);
+       if (ret) {
+               goto error;
+       }
+end:
+       free(sock_path);
+       return channel;
+error:
+       lttng_notification_channel_destroy(channel);
+       channel = NULL;
+       goto end;
+}
+
+enum lttng_notification_channel_status
+lttng_notification_channel_get_next_notification(
+               struct lttng_notification_channel *channel,
+               struct lttng_notification **_notification)
+{
+       int ret;
+       struct lttng_notification *notification = NULL;
+       enum lttng_notification_channel_status status =
+                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       struct lttng_poll_event events;
+
+       if (!channel || !_notification) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
+               goto end;
+       }
+
+       pthread_mutex_lock(&channel->lock);
+
+       if (channel->pending_notifications.count) {
+               struct pending_notification *pending_notification;
+
+               LTTNG_ASSERT(!cds_list_empty(&channel->pending_notifications.list));
+
+               /* Deliver one of the pending notifications. */
+               pending_notification = cds_list_first_entry(
+                               &channel->pending_notifications.list,
+                               struct pending_notification,
+                               node);
+               notification = pending_notification->notification;
+               if (!notification) {
+                       status = LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED;
+               }
+               cds_list_del(&pending_notification->node);
+               channel->pending_notifications.count--;
+               free(pending_notification);
+               goto end_unlock;
+       }
+
+       /*
+        * Block on interruptible epoll/poll() instead of the message reception
+        * itself as the recvmsg() wrappers always restart on EINTR. We choose
+        * to wait using interruptible epoll/poll() in order to:
+        *   1) Return if a signal occurs,
+        *   2) Not deal with partially received messages.
+        *
+        * The drawback to this approach is that we assume that messages
+        * are complete/well formed. If a message is shorter than its
+        * announced length, receive_message() will block on recvmsg()
+        * and never return (even if a signal is received).
+        */
+       ret = lttng_poll_create(&events, 1, LTTNG_CLOEXEC);
+       if (ret < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_unlock;
+       }
+       ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
+       if (ret < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+       ret = lttng_poll_wait_interruptible(&events, -1);
+       if (ret <= 0) {
+               status = (ret == -1 && errno == EINTR) ?
+                       LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED :
+                       LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+
+       ret = receive_message(channel);
+       if (ret) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+
+       switch (get_current_message_type(channel)) {
+       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
+               notification = create_notification_from_current_message(
+                               channel);
+               if (!notification) {
+                       status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+                       goto end_clean_poll;
+               }
+               break;
+       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED:
+               /* No payload to consume. */
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED;
+               break;
+       default:
+               /* Protocol error. */
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+
+end_clean_poll:
+       lttng_poll_clean(&events);
+end_unlock:
+       pthread_mutex_unlock(&channel->lock);
+       *_notification = notification;
+end:
+       return status;
+}
+
+static
+int enqueue_dropped_notification(
+               struct lttng_notification_channel *channel)
+{
+       int ret = 0;
+       struct pending_notification *pending_notification;
+       struct cds_list_head *last_element =
+                       channel->pending_notifications.list.prev;
+
+       pending_notification = caa_container_of(last_element,
+                       struct pending_notification, node);
+       if (!pending_notification->notification) {
+               /*
+                * The last enqueued notification indicates dropped
+                * notifications; there is nothing to do as we group
+                * dropped notifications together.
+                */
+               goto end;
+       }
+
+       if (channel->pending_notifications.count >=
+                       DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT &&
+                       pending_notification->notification) {
+               /*
+                * Discard the last enqueued notification to indicate
+                * that notifications were dropped at this point.
+                */
+               lttng_notification_destroy(
+                               pending_notification->notification);
+               pending_notification->notification = NULL;
+               goto end;
+       }
+
+       pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification));
+       if (!pending_notification) {
+               ret = -1;
+               goto end;
+       }
+       CDS_INIT_LIST_HEAD(&pending_notification->node);
+       cds_list_add(&pending_notification->node,
+                       &channel->pending_notifications.list);
+       channel->pending_notifications.count++;
+end:
+       return ret;
+}
+
+static
+int enqueue_notification_from_current_message(
+               struct lttng_notification_channel *channel)
+{
+       int ret = 0;
+       struct lttng_notification *notification;
+       struct pending_notification *pending_notification;
+
+       if (channel->pending_notifications.count >=
+                       DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT) {
+               /* Drop the notification. */
+               ret = enqueue_dropped_notification(channel);
+               goto end;
+       }
+
+       pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification));
+       if (!pending_notification) {
+               ret = -1;
+               goto error;
+       }
+       CDS_INIT_LIST_HEAD(&pending_notification->node);
+
+       notification = create_notification_from_current_message(channel);
+       if (!notification) {
+               ret = -1;
+               goto error;
+       }
+
+       pending_notification->notification = notification;
+       cds_list_add(&pending_notification->node,
+                       &channel->pending_notifications.list);
+       channel->pending_notifications.count++;
+end:
+       return ret;
+error:
+       free(pending_notification);
+       goto end;
+}
+
+enum lttng_notification_channel_status
+lttng_notification_channel_has_pending_notification(
+               struct lttng_notification_channel *channel,
+               bool *_notification_pending)
+{
+       int ret;
+       enum lttng_notification_channel_status status =
+                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       struct lttng_poll_event events;
+
+       if (!channel || !_notification_pending) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
+               goto end;
+       }
+
+       pthread_mutex_lock(&channel->lock);
+
+       if (channel->pending_notifications.count) {
+               *_notification_pending = true;
+               goto end_unlock;
+       }
+
+       if (channel->socket < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED;
+               goto end_unlock;
+       }
+
+       /*
+        * Check, without blocking, if data is available on the channel's
+        * socket. If there is data available, it is safe to read (blocking)
+        * on the socket for a message from the session daemon.
+        *
+        * Since all commands wait for the session daemon's reply before
+        * releasing the channel's lock, the protocol only allows for
+        * notifications and "notification dropped" messages to come
+        * through. If we receive a different message type, it is
+        * considered a protocol error.
+        *
+        * Note that this function is not guaranteed not to block. This
+        * will block until our peer (the session daemon) has sent a complete
+        * message if we see data available on the socket. If the peer does
+        * not respect the protocol, this may block indefinitely.
+        */
+       ret = lttng_poll_create(&events, 1, LTTNG_CLOEXEC);
+       if (ret < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_unlock;
+       }
+       ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
+       if (ret < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+       /* timeout = 0: return immediately. */
+       ret = lttng_poll_wait_interruptible(&events, 0);
+       if (ret == 0) {
+               /* No data available. */
+               *_notification_pending = false;
+               goto end_clean_poll;
+       } else if (ret < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+
+       /* Data available on socket. */
+       ret = receive_message(channel);
+       if (ret) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+
+       switch (get_current_message_type(channel)) {
+       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
+               ret = enqueue_notification_from_current_message(channel);
+               if (ret) {
+                       goto end_clean_poll;
+               }
+               *_notification_pending = true;
+               break;
+       case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED:
+               ret = enqueue_dropped_notification(channel);
+               if (ret) {
+                       goto end_clean_poll;
+               }
+               *_notification_pending = true;
+               break;
+       default:
+               /* Protocol error. */
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_clean_poll;
+       }
+
+end_clean_poll:
+       lttng_poll_clean(&events);
+end_unlock:
+       pthread_mutex_unlock(&channel->lock);
+end:
+       return status;
+}
+
+static
+int receive_command_reply(struct lttng_notification_channel *channel,
+               enum lttng_notification_channel_status *status)
+{
+       int ret;
+       struct lttng_notification_channel_command_reply *reply;
+
+       while (true) {
+               enum lttng_notification_channel_message_type msg_type;
+
+               ret = receive_message(channel);
+               if (ret) {
+                       goto end;
+               }
+
+               msg_type = get_current_message_type(channel);
+               switch (msg_type) {
+               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_COMMAND_REPLY:
+                       goto exit_loop;
+               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
+                       ret = enqueue_notification_from_current_message(
+                                       channel);
+                       if (ret) {
+                               goto end;
+                       }
+                       break;
+               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED:
+                       ret = enqueue_dropped_notification(channel);
+                       if (ret) {
+                               goto end;
+                       }
+                       break;
+               case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE:
+               {
+                       struct lttng_notification_channel_command_handshake *handshake;
+
+                       handshake = (struct lttng_notification_channel_command_handshake *)
+                                       (channel->reception_payload.buffer.data +
+                                       sizeof(struct lttng_notification_channel_message));
+                       channel->version.major = handshake->major;
+                       channel->version.minor = handshake->minor;
+                       channel->version.set = true;
+                       break;
+               }
+               default:
+                       ret = -1;
+                       goto end;
+               }
+       }
+
+exit_loop:
+       if (channel->reception_payload.buffer.size <
+                       (sizeof(struct lttng_notification_channel_message) +
+                       sizeof(*reply))) {
+               /* Invalid message received. */
+               ret = -1;
+               goto end;
+       }
+
+       reply = (struct lttng_notification_channel_command_reply *)
+                       (channel->reception_payload.buffer.data +
+                       sizeof(struct lttng_notification_channel_message));
+       *status = (enum lttng_notification_channel_status) reply->status;
+end:
+       return ret;
+}
+
+static
+int handshake(struct lttng_notification_channel *channel)
+{
+       ssize_t ret;
+       enum lttng_notification_channel_status status =
+                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       struct lttng_notification_channel_command_handshake handshake = {
+               .major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
+               .minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
+       };
+       struct lttng_notification_channel_message msg_header = {
+               .type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE,
+               .size = sizeof(handshake),
+       };
+       char send_buffer[sizeof(msg_header) + sizeof(handshake)];
+
+       memcpy(send_buffer, &msg_header, sizeof(msg_header));
+       memcpy(send_buffer + sizeof(msg_header), &handshake, sizeof(handshake));
+
+       pthread_mutex_lock(&channel->lock);
+
+       ret = lttcomm_send_creds_unix_sock(channel->socket, send_buffer,
+                       sizeof(send_buffer));
+       if (ret < 0) {
+               goto end_unlock;
+       }
+
+       /* Receive handshake info from the sessiond. */
+       ret = receive_command_reply(channel, &status);
+       if (ret < 0) {
+               goto end_unlock;
+       }
+
+       if (!channel->version.set) {
+               ret = -1;
+               goto end_unlock;
+       }
+
+       if (channel->version.major != LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR) {
+               ret = -1;
+               goto end_unlock;
+       }
+
+end_unlock:
+       pthread_mutex_unlock(&channel->lock);
+       return ret;
+}
+
+static
+enum lttng_notification_channel_status send_condition_command(
+               struct lttng_notification_channel *channel,
+               enum lttng_notification_channel_message_type type,
+               const struct lttng_condition *condition)
+{
+       int socket;
+       ssize_t ret;
+       enum lttng_notification_channel_status status =
+                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       struct lttng_payload payload;
+       struct lttng_notification_channel_message cmd_header = {
+               .type = (int8_t) type,
+       };
+
+       lttng_payload_init(&payload);
+
+       if (!channel) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
+               goto end;
+       }
+
+       LTTNG_ASSERT(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE ||
+               type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE);
+
+       pthread_mutex_lock(&channel->lock);
+       socket = channel->socket;
+
+       if (!lttng_condition_validate(condition)) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
+               goto end_unlock;
+       }
+
+       ret = lttng_dynamic_buffer_append(&payload.buffer, &cmd_header,
+                       sizeof(cmd_header));
+       if (ret) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_unlock;
+       }
+
+       ret = lttng_condition_serialize(condition, &payload);
+       if (ret) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID;
+               goto end_unlock;
+       }
+
+       /* Update payload length. */
+       ((struct lttng_notification_channel_message *) payload.buffer.data)->size =
+                       (uint32_t) (payload.buffer.size - sizeof(cmd_header));
+
+       {
+               struct lttng_payload_view pv =
+                               lttng_payload_view_from_payload(
+                                               &payload, 0, -1);
+               const int fd_count =
+                               lttng_payload_view_get_fd_handle_count(&pv);
+
+               /* Update fd count. */
+               ((struct lttng_notification_channel_message *) payload.buffer.data)->fds =
+                       (uint32_t) fd_count;
+
+               ret = lttcomm_send_unix_sock(
+                       socket, pv.buffer.data, pv.buffer.size);
+               if (ret < 0) {
+                       status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+                       goto end_unlock;
+               }
+
+               /* Pass fds if present. */
+               if (fd_count > 0) {
+                       ret = lttcomm_send_payload_view_fds_unix_sock(socket,
+                                       &pv);
+                       if (ret < 0) {
+                               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+                               goto end_unlock;
+                       }
+               }
+       }
+
+       ret = receive_command_reply(channel, &status);
+       if (ret < 0) {
+               status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
+               goto end_unlock;
+       }
+end_unlock:
+       pthread_mutex_unlock(&channel->lock);
+end:
+       lttng_payload_reset(&payload);
+       return status;
+}
+
+enum lttng_notification_channel_status lttng_notification_channel_subscribe(
+               struct lttng_notification_channel *channel,
+               const struct lttng_condition *condition)
+{
+       return send_condition_command(channel,
+                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE,
+                       condition);
+}
+
+enum lttng_notification_channel_status lttng_notification_channel_unsubscribe(
+               struct lttng_notification_channel *channel,
+               const struct lttng_condition *condition)
+{
+       return send_condition_command(channel,
+                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE,
+                       condition);
+}
+
+void lttng_notification_channel_destroy(
+               struct lttng_notification_channel *channel)
+{
+       if (!channel) {
+               return;
+       }
+
+       if (channel->socket >= 0) {
+               (void) lttcomm_close_unix_sock(channel->socket);
+       }
+       pthread_mutex_destroy(&channel->lock);
+       lttng_payload_reset(&channel->reception_payload);
+       free(channel);
+}
diff --git a/src/lib/lttng-ctl/clear.c b/src/lib/lttng-ctl/clear.c
deleted file mode 100644 (file)
index 3face64..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- * Copyright (C) 2019 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- */
-
-#define _LGPL_SOURCE
-#include <string.h>
-
-#include <lttng/lttng-error.h>
-#include <lttng/clear.h>
-#include <lttng/clear-handle.h>
-#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/macros.h>
-#include <common/compat/poll.h>
-#include <common/dynamic-buffer.h>
-#include <common/buffer-view.h>
-#include <common/optional.h>
-
-#include "lttng-ctl-helper.h"
-
-enum communication_state {
-       COMMUNICATION_STATE_RECEIVE_LTTNG_MSG,
-       COMMUNICATION_STATE_RECEIVE_COMMAND_HEADER,
-       COMMUNICATION_STATE_END,
-       COMMUNICATION_STATE_ERROR,
-};
-
-struct lttng_clear_handle {
-       LTTNG_OPTIONAL(enum lttng_error_code) clear_return_code;
-       struct {
-               int socket;
-               struct lttng_poll_event events;
-               size_t bytes_left_to_receive;
-               enum communication_state state;
-               struct lttng_dynamic_buffer buffer;
-               LTTNG_OPTIONAL(size_t) data_size;
-       } communication;
-};
-
-void lttng_clear_handle_destroy(struct lttng_clear_handle *handle)
-{
-       int ret;
-
-       if (!handle) {
-               return;
-       }
-
-       if (handle->communication.socket >= 0) {
-               ret = close(handle->communication.socket);
-               if (ret) {
-                       PERROR("Failed to close lttng-sessiond command socket");
-               }
-       }
-       lttng_poll_clean(&handle->communication.events);
-       lttng_dynamic_buffer_reset(&handle->communication.buffer);
-       free(handle);
-}
-
-static
-struct lttng_clear_handle *lttng_clear_handle_create(int sessiond_socket)
-{
-       int ret;
-       struct lttng_clear_handle *handle = zmalloc(sizeof(*handle));
-
-       if (!handle) {
-               goto end;
-       }
-       lttng_dynamic_buffer_init(&handle->communication.buffer);
-       handle->communication.socket = sessiond_socket;
-       ret = lttng_poll_create(&handle->communication.events, 1, 0);
-       if (ret) {
-               goto error;
-       }
-
-       ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
-                       LPOLLIN | LPOLLHUP | LPOLLRDHUP | LPOLLERR);
-       if (ret) {
-               goto error;
-       }
-
-       handle->communication.bytes_left_to_receive =
-                       sizeof(struct lttcomm_lttng_msg);
-       handle->communication.state = COMMUNICATION_STATE_RECEIVE_LTTNG_MSG;
-end:
-       return handle;
-error:
-       lttng_clear_handle_destroy(handle);
-       return NULL;
-}
-
-static
-int handle_state_transition(struct lttng_clear_handle *handle)
-{
-       int ret = 0;
-
-       LTTNG_ASSERT(handle->communication.bytes_left_to_receive == 0);
-
-       switch (handle->communication.state) {
-       case COMMUNICATION_STATE_RECEIVE_LTTNG_MSG:
-       {
-               const struct lttcomm_lttng_msg *msg =
-                               (typeof(msg)) handle->communication.buffer.data;
-
-               LTTNG_OPTIONAL_SET(&handle->clear_return_code,
-                               (enum lttng_error_code) msg->ret_code);
-               if (handle->clear_return_code.value != LTTNG_OK) {
-                       handle->communication.state = COMMUNICATION_STATE_END;
-                       break;
-               } else if (msg->cmd_header_size != 0 || msg->data_size != 0) {
-                       handle->communication.state = COMMUNICATION_STATE_ERROR;
-                       ret = -1;
-                       break;
-               }
-
-               handle->communication.state = COMMUNICATION_STATE_END;
-               handle->communication.bytes_left_to_receive = 0;
-               LTTNG_OPTIONAL_SET(&handle->communication.data_size, 0);
-               ret = lttng_dynamic_buffer_set_size(
-                               &handle->communication.buffer, 0);
-               LTTNG_ASSERT(!ret);
-               break;
-       }
-       default:
-               abort();
-       }
-
-       /* Clear reception buffer on state transition. */
-       if (lttng_dynamic_buffer_set_size(&handle->communication.buffer, 0)) {
-               abort();
-       }
-       return ret;
-}
-
-static
-int handle_incoming_data(struct lttng_clear_handle *handle)
-{
-       int ret;
-       ssize_t comm_ret;
-       const size_t original_buffer_size = handle->communication.buffer.size;
-
-       /* Reserve space for reception. */
-       ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer,
-                       original_buffer_size + handle->communication.bytes_left_to_receive);
-       if (ret) {
-               goto end;
-       }
-
-       comm_ret = lttcomm_recv_unix_sock(handle->communication.socket,
-                       handle->communication.buffer.data + original_buffer_size,
-                       handle->communication.bytes_left_to_receive);
-       if (comm_ret <= 0) {
-               ret = -1;
-               goto end;
-       }
-
-       handle->communication.bytes_left_to_receive -= comm_ret;
-       if (handle->communication.bytes_left_to_receive == 0) {
-               ret = handle_state_transition(handle);
-       } else {
-               ret = lttng_dynamic_buffer_set_size(
-                               &handle->communication.buffer,
-                               original_buffer_size + comm_ret);
-       }
-end:
-       return ret;
-}
-
-extern enum lttng_clear_handle_status
-       lttng_clear_handle_wait_for_completion(
-               struct lttng_clear_handle *handle, int timeout_ms)
-{
-       enum lttng_clear_handle_status status;
-       unsigned long time_left_ms = 0;
-       const bool has_timeout = timeout_ms > 0;
-       struct timespec initial_time;
-
-       if (handle->communication.state == COMMUNICATION_STATE_ERROR) {
-               status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-               goto end;
-       } else if (handle->communication.state == COMMUNICATION_STATE_END) {
-               status = LTTNG_CLEAR_HANDLE_STATUS_COMPLETED;
-               goto end;
-       }
-       if (has_timeout) {
-               int ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
-               if (ret) {
-                       status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-                       goto end;
-               }
-               time_left_ms = (unsigned long) timeout_ms;
-       }
-
-       while (handle->communication.state != COMMUNICATION_STATE_END &&
-                       (time_left_ms || !has_timeout)) {
-               int ret;
-               uint32_t revents;
-               struct timespec current_time, diff;
-               unsigned long diff_ms;
-
-               ret = lttng_poll_wait(&handle->communication.events,
-                               has_timeout ? time_left_ms : -1);
-               if (ret == 0) {
-                       /* timeout */
-                       break;
-               } else if (ret < 0) {
-                       status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-                       goto end;
-               }
-
-               /* The sessiond connection socket is the only monitored fd. */
-               revents = LTTNG_POLL_GETEV(&handle->communication.events, 0);
-               if (revents & LPOLLIN) {
-                       ret = handle_incoming_data(handle);
-                       if (ret) {
-                               handle->communication.state =
-                                               COMMUNICATION_STATE_ERROR;
-                               status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-                               goto end;
-                       }
-               } else {
-                       handle->communication.state = COMMUNICATION_STATE_ERROR;
-                       status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-                       goto end;
-               }
-               if (!has_timeout) {
-                       continue;
-               }
-
-               ret = lttng_clock_gettime(CLOCK_MONOTONIC, &current_time);
-               if (ret) {
-                       status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-                       goto end;
-               }
-               diff = timespec_abs_diff(initial_time, current_time);
-               ret = timespec_to_ms(diff, &diff_ms);
-               if (ret) {
-                       ERR("Failed to compute elapsed time while waiting for completion");
-                       status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
-                       goto end;