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 += ...".
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 \
#ifndef LTTNG_ACTION_H
#define LTTNG_ACTION_H
+#include <lttng/lttng-export.h>
+
struct lttng_action;
#ifdef __cplusplus
*
* 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
}
#ifndef LTTNG_ACTION_LIST_H
#define LTTNG_ACTION_LIST_H
+#include <lttng/lttng-export.h>
+
struct lttng_action;
#ifdef __cplusplus
* 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.
*
* 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);
/*
*
* 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);
#ifndef LTTNG_ACTION_NOTIFY_H
#define LTTNG_ACTION_NOTIFY_H
+#include <lttng/lttng-export.h>
+
struct lttng_action;
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_notify_create(void);
+LTTNG_EXPORT extern struct lttng_action *lttng_action_notify_create(void);
/*
* Set the rate policy of a notify action.
* 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);
* 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);
#ifndef LTTNG_ACTION_PATH_H
#define LTTNG_ACTION_PATH_H
+#include <lttng/lttng-export.h>
#include <stdint.h>
#include <stddef.h>
*
* 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);
/*
* 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
}
#define LTTNG_RATE_POLICY_H
#include <inttypes.h>
+#include <lttng/lttng-export.h>
#include <sys/types.h>
struct lttng_rate_policy;
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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
}
#ifndef LTTNG_ACTION_ROTATE_SESSION_H
#define LTTNG_ACTION_ROTATE_SESSION_H
+#include <lttng/lttng-export.h>
+
struct lttng_action;
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_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);
/*
* 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);
* 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);
#ifndef LTTNG_ACTION_SNAPSHOT_SESSION_H
#define LTTNG_ACTION_SNAPSHOT_SESSION_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* 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);
/*
*
* 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);
* 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);
* 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);
#ifndef LTTNG_ACTION_START_SESSION_H
#define LTTNG_ACTION_START_SESSION_H
+#include <lttng/lttng-export.h>
+
struct lttng_action;
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_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);
/*
* 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);
* 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);
#ifndef LTTNG_ACTION_STOP_SESSION_H
#define LTTNG_ACTION_STOP_SESSION_H
+#include <lttng/lttng-export.h>
+
struct lttng_action;
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_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);
/*
* 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);
* 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);
#include <lttng/domain.h>
#include <lttng/event.h>
+#include <lttng/lttng-export.h>
#include <stdint.h>
#ifdef __cplusplus
/*
*/
-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.
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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
#define LTTNG_CLEAR_HANDLE_H
#include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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.
* 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);
* 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);
#define LTTNG_CLEAR_H
#include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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
}
#include <lttng/condition/condition.h>
#include <stdint.h>
#include <lttng/domain.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
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);
/*
* 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);
/*
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
#ifndef LTTNG_CONDITION_H
#define LTTNG_CONDITION_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* 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
}
#define LTTNG_EVALUATION_H
#include <lttng/condition/condition.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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
}
#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" {
* 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);
/*
* 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);
* `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);
* `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);
* `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);
* 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);
#include <lttng/condition/evaluation.h>
#include <lttng/condition/condition.h>
+#include <lttng/lttng-export.h>
#include <stdint.h>
#ifdef __cplusplus
* 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);
/*
* 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);
* 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);
* 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);
* 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);
* 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);
#include <stdint.h>
#include <lttng/domain.h>
#include <lttng/location.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
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);
/*
* 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);
/*
* 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);
* 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);
* 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);
* 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);
#include <lttng/rotation.h>
#include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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);
/*
* 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);
* 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);
* 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);
* 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);
#endif
#include <lttng/constant.h>
+#include <lttng/lttng-export.h>
/*
* Domain types: the different possible tracers.
* 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
#ifndef LTTNG_ENDPOINT_H
#define LTTNG_ENDPOINT_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* - 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.
* - 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
}
#define LTTNG_ERROR_QUERY_H
#include <lttng/lttng.h>
+#include <lttng/lttng-export.h>
#include <lttng/trigger/trigger.h>
#include <stdint.h>
};
/* 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);
/*
* `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.
* 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);
#ifndef LTTNG_EVENT_EXPR_H
#define LTTNG_EVENT_EXPR_H
+#include <lttng/lttng-export.h>
#include <stdbool.h>
struct lttng_event_expr;
* 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);
/*
* * 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);
/*
* * 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);
/*
* * 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);
/*
* * 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);
/*
* * `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);
* * 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);
* * 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);
* * `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);
* * 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);
* `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);
*
* `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
}
#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;
* `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);
/*
* `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);
* `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);
* `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);
* * 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);
* `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);
* * 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,
#ifndef LTTNG_EVENT_RULE_H
#define LTTNG_EVENT_RULE_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* 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
}
#include <lttng/event-rule/event-rule.h>
#include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
#include <lttng/event.h>
#ifdef __cplusplus
* 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.
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
* 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);
#define LTTNG_EVENT_RULE_KERNEL_KPROBE_H
#include <lttng/event-rule/event-rule.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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);
/*
* 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);
* 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);
/*
* 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
#define LTTNG_EVENT_RULE_KERNEL_SYSCALL_H
#include <lttng/event-rule/event-rule.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
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_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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
*
* 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);
#include <lttng/event-rule/event-rule.h>
#include <lttng/event.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
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.
* 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);
/*
* 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);
/*
* 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);
/*
* 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
#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
* 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);
/*
* 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);
* 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);
/*
* 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
#include <lttng/event-rule/event-rule.h>
#include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
#include <lttng/event.h>
#ifdef __cplusplus
* 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.
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
* 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);
#include <lttng/event-rule/event-rule.h>
#include <lttng/log-level-rule.h>
+#include <lttng/lttng-export.h>
#include <lttng/event.h>
#ifdef __cplusplus
* 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.
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
* 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);
#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
* 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.
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
* 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);
* 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);
* 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);
* 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,
#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.
*/
* 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);
/*
*
* 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.
* 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.
*
* 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);
/*
* 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.
*
* 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);
/*
* 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);
/*
*
* 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);
/*
* 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);
/*
* 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);
/*
* 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).
*
* 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);
*
* 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);
/*
*
* 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);
*
* 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);
*
* 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);
/*
*
* 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);
#define LTTNG_HANDLE_H
#include <lttng/domain.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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);
/*
*
* 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
*
*/
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
*
* 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
*
* 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);
/**
*
* 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
* 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
* 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
* 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
* 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);
*
* 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
*
* 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
}
#ifndef LTTNG_KERNEL_PROBE_H
#define LTTNG_KERNEL_PROBE_H
+#include <lttng/lttng-export.h>
#include <stdint.h>
#ifdef __cplusplus
/*
* 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);
* 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);
#ifndef LTTNG_LOAD_H
#define LTTNG_LOAD_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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);
/*
*/
/* 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);
/*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
* 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);
/*
* 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);
/*
*
* 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);
/*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
* 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);
/*
*
* 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
}
#ifndef LTTNG_LOCATION_H
#define LTTNG_LOCATION_H
+#include <lttng/lttng-export.h>
#include <stdint.h>
#ifdef __cplusplus
/*
* 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);
*
* 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);
*
* 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);
* 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);
* 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);
* 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);
*
* 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);
#ifndef LTTNG_LOG_LEVEL_RULE_H
#define LTTNG_LOG_LEVEL_RULE_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* `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);
/*
* 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);
/*
* * `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);
/*
* 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);
/*
* * 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
#ifndef LTTNG_ERROR_H
#define LTTNG_ERROR_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
*
* 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
}
--- /dev/null
+/*
+ * 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
#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>
* 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.
*
* 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);
/*
*
* 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.
*
* 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
*/
#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
*
* 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);
/*
* 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.
* 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
*
* 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
}
#ifndef LTTNG_NOTIFICATION_CHANNEL_H
#define LTTNG_NOTIFICATION_CHANNEL_H
+#include <lttng/lttng-export.h>
#include <stdbool.h>
#ifdef __cplusplus
* 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);
/*
* - 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);
* - 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);
* 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);
* 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);
/*
* 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
#ifndef LTTNG_NOTIFICATION_H
#define LTTNG_NOTIFICATION_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
*
* 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);
/*
*
* 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);
/*
*
* 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
}
#include <stdint.h>
#include <lttng/location.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
* 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);
* 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);
/*
* 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);
/*
* 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);
/*
* 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);
* 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);
/*
* 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);
*
* 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);
* 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);
* 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);
*
* 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);
#ifndef LTTNG_SAVE_H
#define LTTNG_SAVE_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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);
/*
*/
/* 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);
/*
* 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);
/*
*
* 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
}
#ifndef LTTNG_SESSION_DESCRIPTOR_H
#define LTTNG_SESSION_DESCRIPTOR_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
*
* 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);
/*
*
* 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);
/*
*
* 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);
*
* 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);
/*
*
* 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);
*
* 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);
*
* 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);
*
* 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,
* 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);
* 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
#endif
#include <lttng/constant.h>
+#include <lttng/lttng-export.h>
struct lttng_handle;
struct lttng_session_descriptor;
* 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);
/*
*
* 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
*
* 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);
/*
*
* 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);
/*
*
* 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.
* 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.
*
* 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.
* 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);
/*
*
* 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
#define LTTNG_SNAPSHOT_H
#include <limits.h>
+#include <lttng/lttng-export.h>
#include <stdint.h>
#include <sys/types.h>
/*
* 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
*/
/* 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.
*/
/* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
* 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);
/*
* 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.
*
* 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
#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>
* 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,
/*
* 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);
/*
* 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);
* 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);
* 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,
* 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,
* 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,
* 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,
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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,
* 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,
* 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,
* 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,
* 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,
*
* 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);
*
* 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`.
*
* 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
}
#include <lttng/constant.h>
#include <inttypes.h>
#include <lttng/lttng-error.h>
+#include <lttng/lttng-export.h>
struct lttng_action;
struct lttng_condition;
* 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);
/*
* 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);
/*
* 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);
/*
*
* 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);
/*
*
* 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);
/*
* 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.
*
* 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);
*
* 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);
/*
*
* 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.
*
* 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);
/*
*
* 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);
/*
* 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
* 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
}
#ifndef LTTNG_USERSPACE_PROBE_H
#define LTTNG_USERSPACE_PROBE_H
+#include <lttng/lttng-export.h>
+
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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);
/*
* 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);
* 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);
/*
* 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);
* 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);
*
* 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);
* 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);
/*
* 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
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 */
#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.
*/
#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)
{
#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;
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;
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;
};
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";
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,
*/
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
/* 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;
#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));
[ \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);
+}
*
*/
-#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 */
#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;
#define _COMMON_INDEX_ALLOCATOR_H
#include <inttypes.h>
+#include <lttng/lttng-export.h>
#ifdef __cplusplus
extern "C" {
/*
* 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);
* 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
}
*
*/
-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 */
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
};
/* 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;
* 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;
*
*/
+#include <lttng/lttng-export.h>
#include <stdbool.h>
#if defined(__cplusplus)
* 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)
}
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
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) \
+++ /dev/null
-/*
- * 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, ¬ification);
- }
-
- 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);
-}
--- /dev/null
+/*
+ * 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, ¬ification);
+ }
+
+ 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);
+}
+++ /dev/null
-/*
- * 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, ¤t_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;