*/
#include <lttng/lttng.h>
+
+#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <assert.h>
#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME 200000 /* usec */
static void sighandler(int signal __attribute__((unused)))
{
const char msg[] = "Signal caught, exiting\n";
- const int ret = write(STDOUT_FILENO, msg, sizeof(msg));
+ const int ret = write(STDOUT_FILENO, msg, sizeof(msg));
assert(ret == 0); /* NOLINT assert is not async signal safe */
quit = 1;
strcpy(ev.name, "*");
ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
- ret = lttng_enable_event_with_exclusions(
- chan_handle, &ev, "mychan", NULL, 0, NULL);
+ ret = lttng_enable_event_with_exclusions(chan_handle, &ev, "mychan", NULL, 0, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to enable events (ret = %i)\n", ret);
goto end;
ret = lttng_rotate_session(session_name, NULL, &handle);
if (ret < 0) {
- fprintf(stderr, "Failed to rotate session, %s\n",
- lttng_strerror(ret));
+ fprintf(stderr, "Failed to rotate session, %s\n", lttng_strerror(ret));
goto end;
}
fflush(stdout);
do {
- rotation_status = lttng_rotation_handle_get_state(
- handle, &rotation_state);
+ rotation_status = lttng_rotation_handle_get_state(handle, &rotation_state);
if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
ret = -1;
fprintf(stderr, "Failed to get the current rotation's state\n");
const char *absolute_path;
enum lttng_trace_archive_location_status location_status;
- rotation_status = lttng_rotation_handle_get_archive_location(
- handle, &location);
+ rotation_status = lttng_rotation_handle_get_archive_location(handle, &location);
if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
- fprintf(stderr, "Failed to retrieve the rotation's completed chunk archive location\n");
+ fprintf(stderr,
+ "Failed to retrieve the rotation's completed chunk archive location\n");
ret = -1;
goto end;
}
- location_status =
- lttng_trace_archive_location_local_get_absolute_path(
- location, &absolute_path);
+ location_status = lttng_trace_archive_location_local_get_absolute_path(
+ location, &absolute_path);
if (location_status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
fprintf(stderr, "Failed to get absolute path of completed chunk archive");
ret = -1;
goto end;
}
- printf("Output files of session %s rotated to %s\n",
- session_name, absolute_path);
- ret = snprintf(cmd, PATH_MAX, "%s %s", ext_program,
- absolute_path);
+ printf("Output files of session %s rotated to %s\n", session_name, absolute_path);
+ ret = snprintf(cmd, PATH_MAX, "%s %s", ext_program, absolute_path);
if (ret < 0) {
fprintf(stderr, "Failed to prepare command string\n");
goto end;
}
case LTTNG_ROTATION_STATE_EXPIRED:
printf("Output files of session %s rotated, but the handle expired\n",
- session_name);
+ session_name);
ret = 0;
goto end;
case LTTNG_ROTATION_STATE_ERROR:
- fprintf(stderr, "An error occurred with the rotation of session %s\n",
- session_name);
+ fprintf(stderr,
+ "An error occurred with the rotation of session %s\n",
+ session_name);
ret = -1;
goto end;
case LTTNG_ROTATION_STATE_ONGOING:
abort();
goto end;
case LTTNG_ROTATION_STATE_NO_ROTATION:
- fprintf(stderr, "No rotation was performed on rotation request for session %s\n",
- session_name);
+ fprintf(stderr,
+ "No rotation was performed on rotation request for session %s\n",
+ session_name);
ret = -1;
goto end;
}
static void usage(const char *prog_name)
{
- fprintf(stderr, "Usage: %s <session-name> <delay-sec> <nr-rotate> <program>\n",
- prog_name);
+ fprintf(stderr, "Usage: %s <session-name> <delay-sec> <nr-rotate> <program>\n", prog_name);
fprintf(stderr, " <session-name>: the name of the session you want to create\n");
fprintf(stderr, " <delay-sec>: the delay in seconds between each rotation\n");
fprintf(stderr,
- " <nr-rotate>: the number of rotation you want to perform, "
- "-1 for infinite until ctrl-c\n");
+ " <nr-rotate>: the number of rotation you want to perform, "
+ "-1 for infinite until ctrl-c\n");
fprintf(stderr,
- " <program>: program to run on each chunk, it must be "
- "executable, and expect a trace folder as only argument\n");
+ " <program>: program to run on each chunk, it must be "
+ "executable, and expect a trace folder as only argument\n");
fprintf(stderr, "\nThe trace folder is deleted when this program completes.\n");
}
#include "tracepoint-trigger-example.h"
#include <lttng/tracepoint.h>
+
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
gettimeofday(&tv, NULL);
the_time = tv.tv_sec;
- strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T",
- localtime(&the_time));
+ strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T", localtime(&the_time));
printf("%s.%ld - Tracing event \"trigger_example:my_event\"\n",
- time_str, tv.tv_usec);
+ time_str,
+ tv.tv_usec);
tracepoint(trigger_example, my_event, i);
sleep(2);
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(trigger_example, my_event,
- TP_ARGS(int, iteration),
- TP_FIELDS(
- ctf_integer(uint64_t, iteration, iteration)
- )
-)
+TRACEPOINT_EVENT(trigger_example,
+ my_event,
+ TP_ARGS(int, iteration),
+ TP_FIELDS(ctf_integer(uint64_t, iteration, iteration)))
#endif /* _TRACEPOINT_TRIGGER_EXAMPLE_H */
*
*/
-
#include <signal.h>
int main(void)
#include <common/macros.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
+
#include <lttng/lttng.h>
+
#include <pthread.h>
#include <stdbool.h>
#include <sys/types.h>
} LTTNG_PACKED;
void lttng_action_init(struct lttng_action *action,
- enum lttng_action_type type,
- action_validate_cb validate,
- action_serialize_cb serialize,
- action_equal_cb equal,
- action_destroy_cb destroy,
- action_get_rate_policy_cb get_rate_policy,
- action_add_error_query_results_cb add_error_query_results,
- action_mi_serialize_cb mi);
+ enum lttng_action_type type,
+ action_validate_cb validate,
+ action_serialize_cb serialize,
+ action_equal_cb equal,
+ action_destroy_cb destroy,
+ action_get_rate_policy_cb get_rate_policy,
+ action_add_error_query_results_cb add_error_query_results,
+ action_mi_serialize_cb mi);
bool lttng_action_validate(struct lttng_action *action);
-int lttng_action_serialize(struct lttng_action *action,
- struct lttng_payload *buf);
+int lttng_action_serialize(struct lttng_action *action, struct lttng_payload *buf);
ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
- struct lttng_action **action);
+ struct lttng_action **action);
-bool lttng_action_is_equal(const struct lttng_action *a,
- const struct lttng_action *b);
+bool lttng_action_is_equal(const struct lttng_action *a, const struct lttng_action *b);
void lttng_action_get(struct lttng_action *action);
void lttng_action_put(struct lttng_action *action);
-const char* lttng_action_type_string(enum lttng_action_type action_type);
+const char *lttng_action_type_string(enum lttng_action_type action_type);
void lttng_action_increase_execution_request_count(struct lttng_action *action);
bool lttng_action_should_execute(const struct lttng_action *action);
-enum lttng_action_status lttng_action_add_error_query_results(
- const struct lttng_action *action,
- struct lttng_error_query_results *results);
+enum lttng_action_status
+lttng_action_add_error_query_results(const struct lttng_action *action,
+ struct lttng_error_query_results *results);
/*
* For use by the various lttng_action implementation. Implements the default
* behavior to the generic error "execution failure counter" that all actions
* (except list, which passes-through) provide.
*/
-enum lttng_action_status lttng_action_generic_add_error_query_results(
- const struct lttng_action *action,
- struct lttng_error_query_results *results);
-enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trigger,
- const struct lttng_action *action,
- struct mi_writer *writer,
- const struct mi_lttng_error_query_callbacks
- *error_query_callbacks,
- struct lttng_dynamic_array *action_path_indexes);
+enum lttng_action_status
+lttng_action_generic_add_error_query_results(const struct lttng_action *action,
+ struct lttng_error_query_results *results);
+enum lttng_error_code
+lttng_action_mi_serialize(const struct lttng_trigger *trigger,
+ const struct lttng_action *action,
+ struct mi_writer *writer,
+ const struct mi_lttng_error_query_callbacks *error_query_callbacks,
+ struct lttng_dynamic_array *action_path_indexes);
#endif /* LTTNG_ACTION_INTERNAL_H */
*
* Returns the type of an action on success, LTTNG_ACTION_TYPE_UNKNOWN on error.
*/
-LTTNG_EXPORT extern enum lttng_action_type lttng_action_get_type(
- const struct lttng_action *action);
+LTTNG_EXPORT extern enum lttng_action_type lttng_action_get_type(const struct lttng_action *action);
/*
* Destroy (frees) an action object.
#ifndef LTTNG_ACTION_LIST_INTERNAL_H
#define LTTNG_ACTION_LIST_INTERNAL_H
-#include <sys/types.h>
-
#include <common/macros.hpp>
+#include <sys/types.h>
+
struct lttng_action;
struct lttng_payload_view;
struct mi_writer;
* On success, return the number of bytes consumed from `view`, and the created
* list in `*list`. On failure, return -1.
*/
-extern ssize_t lttng_action_list_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action **list);
-
-extern struct lttng_action *lttng_action_list_borrow_mutable_at_index(
- const struct lttng_action *list, unsigned int index);
-
-enum lttng_error_code lttng_action_list_mi_serialize(const struct lttng_trigger *trigger,
- const struct lttng_action *action,
- struct mi_writer *writer,
- const struct mi_lttng_error_query_callbacks
- *error_query_callbacks,
- struct lttng_dynamic_array *action_path_indexes);
+extern ssize_t lttng_action_list_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action **list);
+
+extern struct lttng_action *
+lttng_action_list_borrow_mutable_at_index(const struct lttng_action *list, unsigned int index);
+
+enum lttng_error_code
+lttng_action_list_mi_serialize(const struct lttng_trigger *trigger,
+ const struct lttng_action *action,
+ struct mi_writer *writer,
+ const struct mi_lttng_error_query_callbacks *error_query_callbacks,
+ struct lttng_dynamic_array *action_path_indexes);
#endif /* LTTNG_ACTION_LIST_INTERNAL_H */
*
* Adding an action list to an action list is not supported.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_add_action(
- struct lttng_action *list, struct lttng_action *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.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_get_count(
- const struct lttng_action *list, unsigned int *count);
+LTTNG_EXPORT extern enum lttng_action_status
+lttng_action_list_get_count(const struct lttng_action *list, unsigned int *count);
/*
* Get an action from the action list at a given index.
*
* Returns an action, or NULL on error.
*/
-LTTNG_EXPORT extern const struct lttng_action *lttng_action_list_get_at_index(
- const struct lttng_action *list,
- unsigned int index);
+LTTNG_EXPORT extern const struct lttng_action *
+lttng_action_list_get_at_index(const struct lttng_action *list, unsigned int index);
#ifdef __cplusplus
}
#ifndef LTTNG_ACTION_NOTIFY_INTERNAL_H
#define LTTNG_ACTION_NOTIFY_INTERNAL_H
-#include <lttng/action/notify.h>
#include <lttng/action/action-internal.hpp>
+#include <lttng/action/notify.h>
struct lttng_action_notify {
struct lttng_action parent;
struct lttng_rate_policy *policy;
};
-ssize_t lttng_action_notify_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action **action);
+ssize_t lttng_action_notify_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action **action);
#endif /* LTTNG_ACTION_NOTIFY_INTERNAL_H */
* LTTNG_ACTION_STATUS_ERROR on internal error,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_set_rate_policy(
- struct lttng_action *action,
- const struct lttng_rate_policy *policy);
+LTTNG_EXPORT extern enum lttng_action_status
+lttng_action_notify_set_rate_policy(struct lttng_action *action,
+ const struct lttng_rate_policy *policy);
/*
* Get the rate policy of a notify action.
* Returns LTTNG_ACTION_STATUS_OK on success,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_get_rate_policy(
- const struct lttng_action *action,
- const struct lttng_rate_policy **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);
#ifdef __cplusplus
}
#ifndef LTTNG_ACTION_PATH_INTERNAL_H
#define LTTNG_ACTION_PATH_INTERNAL_H
-#include <lttng/action/path.h>
-#include <common/macros.hpp>
#include <common/dynamic-array.hpp>
+#include <common/macros.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
+
+#include <lttng/action/path.h>
+
#include <sys/types.h>
struct lttng_action_path {
struct lttng_dynamic_array indexes;
};
-int lttng_action_path_copy(const struct lttng_action_path *src,
- struct lttng_action_path **dst);
+int lttng_action_path_copy(const struct lttng_action_path *src, struct lttng_action_path **dst);
-ssize_t lttng_action_path_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action_path **action_path);
+ssize_t lttng_action_path_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action_path **action_path);
int lttng_action_path_serialize(const struct lttng_action_path *action_path,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
#endif /* LTTNG_ACTION_PATH_INTERNAL_H */
#define LTTNG_ACTION_PATH_H
#include <lttng/lttng-export.h>
-#include <stdint.h>
+
#include <stddef.h>
+#include <stdint.h>
struct lttng_action_path;
*
* The `indexes` are copied internally and can be disposed-of by the caller.
*/
-LTTNG_EXPORT extern struct lttng_action_path *lttng_action_path_create(
- const uint64_t *indexes, size_t index_count);
+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.
*/
-LTTNG_EXPORT extern enum lttng_action_path_status lttng_action_path_get_index_count(
- const struct lttng_action_path *path, size_t *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.
*/
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);
+ const struct lttng_action_path *path, size_t path_index, uint64_t *out_index);
/*
* Destroy an action path object.
#include <common/macros.hpp>
#include <common/payload-view.hpp>
+
#include <lttng/action/rate-policy.h>
#include <lttng/lttng-error.h>
-#include <stdbool.h>
+#include <stdbool.h>
struct mi_writer;
-int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy,
- struct lttng_payload *buf);
+int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy, struct lttng_payload *buf);
ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view,
- struct lttng_rate_policy **rate_policy);
+ struct lttng_rate_policy **rate_policy);
bool lttng_rate_policy_is_equal(const struct lttng_rate_policy *a,
- const struct lttng_rate_policy *b);
+ const struct lttng_rate_policy *b);
-const char *lttng_rate_policy_type_string(
- enum lttng_rate_policy_type rate_policy_type);
+const char *lttng_rate_policy_type_string(enum lttng_rate_policy_type rate_policy_type);
-struct lttng_rate_policy *lttng_rate_policy_copy(
- const struct lttng_rate_policy *source);
+struct lttng_rate_policy *lttng_rate_policy_copy(const struct lttng_rate_policy *source);
-bool lttng_rate_policy_should_execute(
- const struct lttng_rate_policy *policy, uint64_t counter);
+bool lttng_rate_policy_should_execute(const struct lttng_rate_policy *policy, uint64_t counter);
-enum lttng_error_code lttng_rate_policy_mi_serialize(
- const struct lttng_rate_policy *policy,
- struct mi_writer *writer);
+enum lttng_error_code lttng_rate_policy_mi_serialize(const struct lttng_rate_policy *policy,
+ struct mi_writer *writer);
#endif /* LTTNG_RATE_POLICY */
#ifndef LTTNG_RATE_POLICY_H
#define LTTNG_RATE_POLICY_H
-#include <inttypes.h>
#include <lttng/lttng-export.h>
+
+#include <inttypes.h>
#include <sys/types.h>
struct lttng_rate_policy;
/*
* Get the type of a rate policy.
*/
-LTTNG_EXPORT extern enum lttng_rate_policy_type lttng_rate_policy_get_type(
- const struct lttng_rate_policy *policy);
+LTTNG_EXPORT extern enum lttng_rate_policy_type
+lttng_rate_policy_get_type(const struct lttng_rate_policy *policy);
/*
* Create a rate_policy of type `every n`.
* rate_policy objects must be destroyed using the lttng_rate_policy_destroy()
* function.
*/
-LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_every_n_create(
- uint64_t interval);
+LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval);
/*
* Get the interval of a every N rate policy.
* on success, LTTNG_RATE_FIRING_POLICY_STATUS_INVALID if an invalid
* parameter is passed.
*/
-LTTNG_EXPORT extern enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval(
- const struct lttng_rate_policy *policy, uint64_t *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);
/*
* Create a rate_policy of type `once after N`.
* rate_policy objects must be destroyed using the lttng_rate_policy_destroy()
* function.
*/
-LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(
- uint64_t threshold);
+LTTNG_EXPORT extern struct lttng_rate_policy *
+lttng_rate_policy_once_after_n_create(uint64_t threshold);
/*
* Get the threshold of a once after N rate policy.
* parameter is passed.
*/
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);
+lttng_rate_policy_once_after_n_get_threshold(const struct lttng_rate_policy *policy,
+ uint64_t *threshold);
/*
* Destroy (frees) a rate policy object.
* On success, return the number of bytes consumed from `view`, and the created
* action in `*action`. On failure, return -1.
*/
-extern ssize_t lttng_action_rotate_session_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action **action);
+extern ssize_t lttng_action_rotate_session_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action **action);
#endif /* LTTNG_ACTION_ROTATE_SESSION_INTERNAL_H */
* Set the session name of an lttng_action object of type
* LTTNG_ACTION_TYPE_ROTATE_SESSION.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_session_name(
- struct lttng_action *action, const char *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.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_get_session_name(
- const struct lttng_action *action, const char **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);
/*
* Set the rate policy of a rotate session action.
* LTTNG_ACTION_STATUS_ERROR on internal error,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_rate_policy(
- struct lttng_action *action,
- const struct lttng_rate_policy *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);
/*
* Get the rate policy of a rotate session action.
* Returns LTTNG_ACTION_STATUS_OK on success,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-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);
+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);
#ifdef __cplusplus
}
#ifndef LTTNG_ACTION_SNAPSHOT_SESSION_INTERNAL_H
#define LTTNG_ACTION_SNAPSHOT_SESSION_INTERNAL_H
-#include <sys/types.h>
-
#include <common/macros.hpp>
+#include <sys/types.h>
+
struct lttng_action;
struct lttng_payload_view;
* On success, return the number of bytes consumed from `view`, and the created
* action in `*action`. On failure, return -1.
*/
-extern ssize_t lttng_action_snapshot_session_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action **action);
+extern ssize_t lttng_action_snapshot_session_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action **action);
#endif /* LTTNG_ACTION_SNAPSHOT_SESSION_INTERNAL_H */
* Set the session name of an lttng_action object of type
* LTTNG_ACTION_TYPE_SNAPSHOT_SESSION.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_session_name(
- struct lttng_action *action, const char *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.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_session_name(
- const struct lttng_action *action, const char **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);
/*
* Set an explicit snapshot output for this snapshot session action.
*
* This function takes ownership of the given snapshot output.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_output(
- struct lttng_action *action,
- struct lttng_snapshot_output *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.
*/
-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_EXPORT extern enum lttng_action_status
+lttng_action_snapshot_session_get_output(const struct lttng_action *action,
+ const struct lttng_snapshot_output **output);
/*
* Set the rate policy of a snapshot session action.
* LTTNG_ACTION_STATUS_ERROR on internal error,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_rate_policy(
- struct lttng_action *action,
- const struct lttng_rate_policy *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);
/*
* Get the rate policy of a snapshot session action.
* Returns LTTNG_ACTION_STATUS_OK on success,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-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);
+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);
#ifdef __cplusplus
}
* On success, return the number of bytes consumed from `view`, and the created
* action in `*action`. On failure, return -1.
*/
-extern ssize_t lttng_action_start_session_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action **action);
+extern ssize_t lttng_action_start_session_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action **action);
#endif /* LTTNG_ACTION_START_SESSION_INTERNAL_H */
* Set the session name of an lttng_action object of type
* LTTNG_ACTION_TYPE_START_SESSION.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_session_name(
- struct lttng_action *action, const char *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.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_get_session_name(
- const struct lttng_action *action, const char **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);
/*
* Set the rate policy of a start session action.
* LTTNG_ACTION_STATUS_ERROR on internal error,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_rate_policy(
- struct lttng_action *action,
- const struct lttng_rate_policy *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);
/*
* Get the rate policy of a start session action.
* Returns LTTNG_ACTION_STATUS_OK on success,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-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);
+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);
#ifdef __cplusplus
}
* On success, return the number of bytes consumed from `view`, and the created
* action in `*action`. On failure, return -1.
*/
-extern ssize_t lttng_action_stop_session_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_action **action);
+extern ssize_t lttng_action_stop_session_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_action **action);
#endif /* LTTNG_ACTION_STOP_SESSION_INTERNAL_H */
* Set the session name of an lttng_action object of type
* LTTNG_ACTION_TYPE_STOP_SESSION.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_session_name(
- struct lttng_action *action, const char *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.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_get_session_name(
- const struct lttng_action *action, const char **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);
/*
* Set the rate policy of a stop session action.
* LTTNG_ACTION_STATUS_ERROR on internal error,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_rate_policy(
- struct lttng_action *action,
- const struct lttng_rate_policy *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);
/*
* Get the rate policy of a stop session action.
* Returns LTTNG_ACTION_STATUS_OK on success,
* LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed.
*/
-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);
+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);
#ifdef __cplusplus
}
struct lttng_channel *lttng_channel_copy(const struct lttng_channel *src);
ssize_t lttng_channel_create_from_buffer(const struct lttng_buffer_view *view,
- struct lttng_channel **event);
+ struct lttng_channel **event);
-int lttng_channel_serialize(struct lttng_channel *channel,
- struct lttng_dynamic_buffer *buf);
+int lttng_channel_serialize(struct lttng_channel *channel, struct lttng_dynamic_buffer *buf);
void lttng_channel_set_default_extended_attr(struct lttng_domain *domain,
- struct lttng_channel_extended *extended_attr);
+ struct lttng_channel_extended *extended_attr);
enum lttng_error_code lttng_channels_create_and_flatten_from_buffer(
- const struct lttng_buffer_view *view,
- unsigned int count,
- struct lttng_channel **channels);
+ const struct lttng_buffer_view *view, unsigned int count, struct lttng_channel **channels);
#endif /* LTTNG_CHANNEL_INTERNAL_H */
#include <lttng/domain.h>
#include <lttng/event.h>
#include <lttng/lttng-export.h>
+
#include <stdint.h>
#ifdef __cplusplus
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
+#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
struct lttng_channel_attr {
- int overwrite; /* -1: session default, 1: overwrite, 0: discard */
- uint64_t subbuf_size; /* bytes, power of 2 */
- uint64_t num_subbuf; /* power of 2 */
+ int overwrite; /* -1: session default, 1: overwrite, 0: discard */
+ uint64_t subbuf_size; /* bytes, power of 2 */
+ uint64_t num_subbuf; /* power of 2 */
unsigned int switch_timer_interval; /* usec */
- unsigned int read_timer_interval; /* usec */
- enum lttng_event_output output; /* splice, mmap */
+ unsigned int read_timer_interval; /* usec */
+ enum lttng_event_output output; /* splice, mmap */
/* LTTng 2.1 padding limit */
- uint64_t tracefile_size; /* bytes */
- uint64_t tracefile_count; /* number of tracefiles */
+ uint64_t tracefile_size; /* bytes */
+ uint64_t tracefile_count; /* number of tracefiles */
/* LTTng 2.3 padding limit */
- unsigned int live_timer_interval; /* usec */
+ unsigned int live_timer_interval; /* usec */
/* LTTng 2.7 padding limit */
uint32_t align_to_64;
union {
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_CHANNEL_PADDING1 16
+#define LTTNG_CHANNEL_PADDING1 16
struct lttng_channel {
char name[LTTNG_SYMBOL_NAME_LEN];
uint32_t enabled;
* must free channels. On error, a negative LTTng error code is returned.
*/
LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle,
- struct lttng_channel **channels);
+ struct lttng_channel **channels);
/*
* Create or enable a channel.
* Return 0 on success else a negative LTTng error code.
*/
LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle,
- struct lttng_channel *chan);
+ struct lttng_channel *chan);
/*
* Disable channel.
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle,
- const char *name);
+LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, const char *name);
/*
* Set the default channel attributes for a specific domain and an allocated
* If one or both arguments are NULL, nothing happens.
*/
LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
- struct lttng_channel_attr *attr);
+ struct lttng_channel_attr *attr);
/*
* Get the discarded event count of a specific LTTng channel.
* Returns 0 on success, or a negative LTTng error code on error.
*/
LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan,
- uint64_t *discarded_events);
+ uint64_t *discarded_events);
/*
* Get the lost packet count of a specific LTTng channel.
* Returns 0 on success, or a negative LTTng error code on error.
*/
LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan,
- uint64_t *lost_packets);
+ uint64_t *lost_packets);
LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
- uint64_t *monitor_timer_interval);
+ uint64_t *monitor_timer_interval);
LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
- uint64_t monitor_timer_interval);
+ uint64_t monitor_timer_interval);
LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
- int64_t *blocking_timeout);
+ int64_t *blocking_timeout);
LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
- int64_t blocking_timeout);
+ int64_t blocking_timeout);
#ifdef __cplusplus
}
* operation completed successfully.
*/
LTTNG_EXPORT extern enum lttng_clear_handle_status
- lttng_clear_handle_wait_for_completion(
- struct lttng_clear_handle *handle, int timeout_ms);
+lttng_clear_handle_wait_for_completion(struct lttng_clear_handle *handle, int timeout_ms);
/*
* Get the result of a session clear operation.
* invalid (e.g. NULL).
*/
LTTNG_EXPORT extern enum lttng_clear_handle_status
- lttng_clear_handle_get_result(
- const struct lttng_clear_handle *handle,
- enum lttng_error_code *result);
+lttng_clear_handle_get_result(const struct lttng_clear_handle *handle,
+ enum lttng_error_code *result);
#ifdef __cplusplus
}
#endif
* LTTNG_ERR_CLEAR_RELAY_DISALLOWED
* LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY
* LTTNG_ERR_CLEAR_FAIL_CONSUMER
-*/
+ */
LTTNG_EXPORT extern enum lttng_error_code lttng_clear_session(const char *session_name,
- struct lttng_clear_handle **handle);
+ struct lttng_clear_handle **handle);
#ifdef __cplusplus
}
#endif
#ifndef LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H
#define LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H
+#include "common/buffer-view.hpp"
+
+#include <common/macros.hpp>
+
#include <lttng/condition/buffer-usage.h>
#include <lttng/condition/condition-internal.hpp>
#include <lttng/condition/evaluation-internal.hpp>
#include <lttng/domain.h>
-#include "common/buffer-view.hpp"
-#include <common/macros.hpp>
struct lttng_condition_buffer_usage {
struct lttng_condition parent;
uint64_t buffer_capacity;
} LTTNG_PACKED;
-struct lttng_evaluation *lttng_evaluation_buffer_usage_create(
- enum lttng_condition_type type, uint64_t use,
- uint64_t capacity);
+struct lttng_evaluation *lttng_evaluation_buffer_usage_create(enum lttng_condition_type type,
+ uint64_t use,
+ uint64_t capacity);
-ssize_t lttng_condition_buffer_usage_low_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t lttng_condition_buffer_usage_low_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
-ssize_t lttng_condition_buffer_usage_high_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t lttng_condition_buffer_usage_high_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
-ssize_t lttng_evaluation_buffer_usage_low_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_evaluation **evaluation);
+ssize_t lttng_evaluation_buffer_usage_low_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_evaluation **evaluation);
-ssize_t lttng_evaluation_buffer_usage_high_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_evaluation **evaluation);
+ssize_t
+lttng_evaluation_buffer_usage_high_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_evaluation **evaluation);
#endif /* LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H */
#ifndef LTTNG_CONDITION_BUFFER_USAGE_H
#define LTTNG_CONDITION_BUFFER_USAGE_H
-#include <lttng/condition/evaluation.h>
#include <lttng/condition/condition.h>
-#include <stdint.h>
+#include <lttng/condition/evaluation.h>
#include <lttng/domain.h>
#include <lttng/lttng-export.h>
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* Returns a new condition on success, NULL on failure. This condition must be
* destroyed using lttng_condition_destroy().
*/
-LTTNG_EXPORT extern struct lttng_condition *
-lttng_condition_buffer_usage_low_create(void);
+LTTNG_EXPORT extern struct lttng_condition *lttng_condition_buffer_usage_low_create(void);
/*
* Create a newly allocated upper-bound buffer usage condition.
* Returns a new condition on success, NULL on failure. This condition must be
* destroyed using lttng_condition_destroy().
*/
-LTTNG_EXPORT extern struct lttng_condition *
-lttng_condition_buffer_usage_high_create(void);
+LTTNG_EXPORT extern struct lttng_condition *lttng_condition_buffer_usage_high_create(void);
/*
* Get the buffer usage threshold ratio of a buffer usage condition.
* call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_get_threshold_ratio(
- const struct lttng_condition *condition,
- double *threshold_ratio);
+lttng_condition_buffer_usage_get_threshold_ratio(const struct lttng_condition *condition,
+ double *threshold_ratio);
/*
* Set the buffer usage threshold ratio of a buffer usage condition.
* if invalid paramenters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_set_threshold_ratio(
- struct lttng_condition *condition,
- double threshold_ratio);
+lttng_condition_buffer_usage_set_threshold_ratio(struct lttng_condition *condition,
+ double threshold_ratio);
/*
* Get the buffer usage threshold of a buffer usage condition.
* bytes, was not set prior to this call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_get_threshold(
- const struct lttng_condition *condition,
- uint64_t *threshold_bytes);
+lttng_condition_buffer_usage_get_threshold(const struct lttng_condition *condition,
+ uint64_t *threshold_bytes);
/*
* Set the buffer usage threshold in bytes of a buffer usage condition.
* if invalid paramenters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_set_threshold(
- struct lttng_condition *condition,
- uint64_t threshold_bytes);
+lttng_condition_buffer_usage_set_threshold(struct lttng_condition *condition,
+ uint64_t threshold_bytes);
/*
* Get the session name property of a buffer usage condition.
* was not set prior to this call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_get_session_name(
- const struct lttng_condition *condition,
- const char **session_name);
+lttng_condition_buffer_usage_get_session_name(const struct lttng_condition *condition,
+ const char **session_name);
/*
* Set the session name property of a buffer usage condition.
* if invalid paramenters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_set_session_name(
- struct lttng_condition *condition,
- const char *session_name);
+lttng_condition_buffer_usage_set_session_name(struct lttng_condition *condition,
+ const char *session_name);
/*
* Get the channel name property of a buffer usage condition.
* was not set prior to this call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_get_channel_name(
- const struct lttng_condition *condition,
- const char **channel_name);
+lttng_condition_buffer_usage_get_channel_name(const struct lttng_condition *condition,
+ const char **channel_name);
/*
* Set the channel name property of a buffer usage condition.
* if invalid paramenters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_set_channel_name(
- struct lttng_condition *condition,
- const char *channel_name);
+lttng_condition_buffer_usage_set_channel_name(struct lttng_condition *condition,
+ const char *channel_name);
/*
* Get the domain type property of a buffer usage condition.
* call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_get_domain_type(
- const struct lttng_condition *condition,
- enum lttng_domain_type *type);
+lttng_condition_buffer_usage_get_domain_type(const struct lttng_condition *condition,
+ enum lttng_domain_type *type);
/*
* Set the domain type property of a buffer usage condition.
* if invalid paramenters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_buffer_usage_set_domain_type(
- struct lttng_condition *condition,
- enum lttng_domain_type type);
-
+lttng_condition_buffer_usage_set_domain_type(struct lttng_condition *condition,
+ enum lttng_domain_type type);
/**
* lttng_evaluation_buffer_usage are specialised lttng_evaluations which
* an invalid parameter is passed.
*/
LTTNG_EXPORT extern enum lttng_evaluation_status
-lttng_evaluation_buffer_usage_get_usage_ratio(
- const struct lttng_evaluation *evaluation,
- double *usage_ratio);
+lttng_evaluation_buffer_usage_get_usage_ratio(const struct lttng_evaluation *evaluation,
+ double *usage_ratio);
/*
* Get the buffer usage property of a buffer usage evaluation.
* bytes, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is passed.
*/
LTTNG_EXPORT extern enum lttng_evaluation_status
-lttng_evaluation_buffer_usage_get_usage(
- const struct lttng_evaluation *evaluation,
- uint64_t *usage_bytes);
+lttng_evaluation_buffer_usage_get_usage(const struct lttng_evaluation *evaluation,
+ uint64_t *usage_bytes);
#ifdef __cplusplus
}
#include <common/macros.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
+
#include <lttng/condition/condition.h>
#include <lttng/lttng-error.h>
+
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
void lttng_condition_put(struct lttng_condition *condition);
-void lttng_condition_init(struct lttng_condition *condition,
- enum lttng_condition_type type);
+void lttng_condition_init(struct lttng_condition *condition, enum lttng_condition_type type);
bool lttng_condition_validate(const struct lttng_condition *condition);
-ssize_t lttng_condition_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t lttng_condition_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
int lttng_condition_serialize(const struct lttng_condition *condition,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
-bool lttng_condition_is_equal(const struct lttng_condition *a,
- const struct lttng_condition *b);
+bool lttng_condition_is_equal(const struct lttng_condition *a, const struct lttng_condition *b);
-enum lttng_error_code lttng_condition_mi_serialize(
- const struct lttng_trigger *trigger,
- const struct lttng_condition *condition,
- struct mi_writer *writer,
- const struct mi_lttng_error_query_callbacks
- *error_query_callbacks);
+enum lttng_error_code
+lttng_condition_mi_serialize(const struct lttng_trigger *trigger,
+ const struct lttng_condition *condition,
+ struct mi_writer *writer,
+ const struct mi_lttng_error_query_callbacks *error_query_callbacks);
const char *lttng_condition_type_str(enum lttng_condition_type type);
* Returns the type of a condition on success, LTTNG_CONDITION_TYPE_UNKNOWN on
* error.
*/
-LTTNG_EXPORT extern enum lttng_condition_type lttng_condition_get_type(
- const struct lttng_condition *condition);
+LTTNG_EXPORT extern enum lttng_condition_type
+lttng_condition_get_type(const struct lttng_condition *condition);
/*
* Destroy (release) a condition object.
#ifndef LTTNG_EVALUATION_INTERNAL_H
#define LTTNG_EVALUATION_INTERNAL_H
-#include <lttng/condition/evaluation.h>
-#include <lttng/condition/condition.h>
#include <common/macros.hpp>
+
+#include <lttng/condition/condition.h>
+#include <lttng/condition/evaluation.h>
+
#include <stdbool.h>
#include <sys/types.h>
evaluation_destroy_cb destroy;
};
-void lttng_evaluation_init(struct lttng_evaluation *evaluation,
- enum lttng_condition_type type);
+void lttng_evaluation_init(struct lttng_evaluation *evaluation, enum lttng_condition_type type);
-ssize_t lttng_evaluation_create_from_payload(
- const struct lttng_condition *condition,
- struct lttng_payload_view *view,
- struct lttng_evaluation **evaluation);
+ssize_t lttng_evaluation_create_from_payload(const struct lttng_condition *condition,
+ struct lttng_payload_view *view,
+ struct lttng_evaluation **evaluation);
int lttng_evaluation_serialize(const struct lttng_evaluation *evaluation,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
#endif /* LTTNG_EVALUATION_INTERNAL_H */
* Returns the type of a condition on success, LTTNG_CONDITION_TYPE_UNKNOWN on
* error.
*/
-LTTNG_EXPORT extern enum lttng_condition_type lttng_evaluation_get_type(
- const struct lttng_evaluation *evaluation);
+LTTNG_EXPORT extern enum lttng_condition_type
+lttng_evaluation_get_type(const struct lttng_evaluation *evaluation);
/*
* Destroy (frees) an evaluation object.
#ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H
#define LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H
-#include <lttng/condition/condition-internal.hpp>
#include <common/buffer-view.hpp>
+#include <common/dynamic-array.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+
+#include <lttng/condition/condition-internal.hpp>
#include <lttng/condition/evaluation-internal.hpp>
-#include <common/dynamic-array.hpp>
#include <lttng/event-field-value.h>
struct lttng_capture_descriptor {
struct lttng_event_field_value *captured_values;
};
-ssize_t lttng_condition_event_rule_matches_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t lttng_condition_event_rule_matches_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
enum lttng_condition_status
-lttng_condition_event_rule_matches_borrow_rule_mutable(
- const struct lttng_condition *condition,
- struct lttng_event_rule **rule);
+lttng_condition_event_rule_matches_borrow_rule_mutable(const struct lttng_condition *condition,
+ struct lttng_event_rule **rule);
-void lttng_condition_event_rule_matches_set_error_counter_index(
- struct lttng_condition *condition,
- uint64_t error_counter_index);
+void lttng_condition_event_rule_matches_set_error_counter_index(struct lttng_condition *condition,
+ uint64_t error_counter_index);
-uint64_t lttng_condition_event_rule_matches_get_error_counter_index(
- const struct lttng_condition *condition);
+uint64_t
+lttng_condition_event_rule_matches_get_error_counter_index(const struct lttng_condition *condition);
struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
- const struct lttng_condition_event_rule_matches *condition,
- const char *capture_payload,
- size_t capture_payload_size,
- bool decode_capture_payload);
+ const struct lttng_condition_event_rule_matches *condition,
+ const char *capture_payload,
+ size_t capture_payload_size,
+ bool decode_capture_payload);
ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
- const struct lttng_condition_event_rule_matches *condition,
- struct lttng_payload_view *view,
- struct lttng_evaluation **_evaluation);
+ const struct lttng_condition_event_rule_matches *condition,
+ struct lttng_payload_view *view,
+ struct lttng_evaluation **_evaluation);
-enum lttng_error_code
-lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
- struct lttng_condition *condition);
+enum lttng_error_code lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
+ struct lttng_condition *condition);
-const struct lttng_bytecode *
-lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
- const struct lttng_condition *condition, unsigned int index);
+const struct lttng_bytecode *lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
+ const struct lttng_condition *condition, unsigned int index);
#endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */
#ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_H
#define LTTNG_CONDITION_EVENT_RULE_MATCHES_H
-#include <lttng/event-rule/event-rule.h>
#include <lttng/condition/condition.h>
#include <lttng/condition/evaluation.h>
+#include <lttng/event-rule/event-rule.h>
#include <lttng/lttng-export.h>
#ifdef __cplusplus
* Returns a new condition on success, NULL on failure. This condition must be
* destroyed using lttng_condition_destroy().
*/
-LTTNG_EXPORT extern struct lttng_condition *lttng_condition_event_rule_matches_create(
- struct lttng_event_rule *rule);
+LTTNG_EXPORT extern struct lttng_condition *
+lttng_condition_event_rule_matches_create(struct lttng_event_rule *rule);
/*
* Get the rule property of an Event Rule Matches condition.
* 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. */
-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_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_hit are specialised lttng_evaluations
*/
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);
+ const struct lttng_evaluation *evaluation,
+ const struct lttng_event_field_value **field_val);
/*
* Appends (transfering the ownership) the capture descriptor `expr` to
* * The associated event-rule does not support runtime capture.
*/
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_event_rule_matches_append_capture_descriptor(struct lttng_condition *condition,
+ struct lttng_event_expr *expr);
/*
* Sets `*count` to the number of capture descriptors in the Event Rule Matches
*/
LTTNG_EXPORT extern enum lttng_condition_status
lttng_condition_event_rule_matches_get_capture_descriptor_count(
- const struct lttng_condition *condition, unsigned int *count);
+ const struct lttng_condition *condition, unsigned int *count);
/*
* Returns the capture descriptor (borrowed) of the Event Rule Matches condition
*/
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);
+ const struct lttng_condition *condition, unsigned int index);
#ifdef __cplusplus
}
#ifndef LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H
#define LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H
-#include <lttng/condition/session-consumed-size.h>
-#include <lttng/condition/condition-internal.hpp>
-#include <lttng/condition/evaluation-internal.hpp>
#include <common/buffer-view.hpp>
#include <common/macros.hpp>
+#include <lttng/condition/condition-internal.hpp>
+#include <lttng/condition/evaluation-internal.hpp>
+#include <lttng/condition/session-consumed-size.h>
+
struct lttng_payload;
struct lttng_payload_view;
uint64_t session_consumed;
} LTTNG_PACKED;
-struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(
- uint64_t consumed);
+struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(uint64_t consumed);
-ssize_t lttng_condition_session_consumed_size_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t
+lttng_condition_session_consumed_size_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
-ssize_t lttng_evaluation_session_consumed_size_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_evaluation **evaluation);
+ssize_t
+lttng_evaluation_session_consumed_size_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_evaluation **evaluation);
#endif /* LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H */
#ifndef LTTNG_CONDITION_SESSION_CONSUMED_SIZE_H
#define LTTNG_CONDITION_SESSION_CONSUMED_SIZE_H
-#include <lttng/condition/evaluation.h>
#include <lttng/condition/condition.h>
+#include <lttng/condition/evaluation.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().
*/
-LTTNG_EXPORT extern struct lttng_condition *
-lttng_condition_session_consumed_size_create(void);
+LTTNG_EXPORT extern struct lttng_condition *lttng_condition_session_consumed_size_create(void);
/*
* Get the threshold of a session consumed size condition.
* bytes, was not set prior to this call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_session_consumed_size_get_threshold(
- const struct lttng_condition *condition,
- uint64_t *consumed_threshold_bytes);
+lttng_condition_session_consumed_size_get_threshold(const struct lttng_condition *condition,
+ uint64_t *consumed_threshold_bytes);
/*
* Set the threshold of a session consumed size usage condition.
* if invalid parameters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_session_consumed_size_set_threshold(
- struct lttng_condition *condition,
- uint64_t consumed_threshold_bytes);
+lttng_condition_session_consumed_size_set_threshold(struct lttng_condition *condition,
+ uint64_t consumed_threshold_bytes);
/*
* Get the session name property of a session consumed size condition.
* was not set prior to this call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_session_consumed_size_get_session_name(
- const struct lttng_condition *condition,
- const char **session_name);
+lttng_condition_session_consumed_size_get_session_name(const struct lttng_condition *condition,
+ const char **session_name);
/*
* Set the session name property of a session consumed size condition.
* if invalid parameters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_session_consumed_size_set_session_name(
- struct lttng_condition *condition,
- const char *session_name);
+lttng_condition_session_consumed_size_set_session_name(struct lttng_condition *condition,
+ const char *session_name);
/**
* lttng_evaluation_session_consumed_size is specialised lttng_evaluations
* bytes, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is passed.
*/
LTTNG_EXPORT extern enum lttng_evaluation_status
-lttng_evaluation_session_consumed_size_get_consumed_size(
- const struct lttng_evaluation *evaluation,
- uint64_t *session_consumed);
+lttng_evaluation_session_consumed_size_get_consumed_size(const struct lttng_evaluation *evaluation,
+ uint64_t *session_consumed);
#ifdef __cplusplus
}
#ifndef LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H
#define LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H
-#include <lttng/condition/session-rotation.h>
+#include "common/buffer-view.hpp"
+
+#include <common/macros.hpp>
+
#include <lttng/condition/condition-internal.hpp>
#include <lttng/condition/evaluation-internal.hpp>
-#include "common/buffer-view.hpp"
+#include <lttng/condition/session-rotation.h>
#include <lttng/location.h>
-#include <common/macros.hpp>
struct lttng_condition_session_rotation {
struct lttng_condition parent;
uint8_t has_location;
} LTTNG_PACKED;
-ssize_t lttng_condition_session_rotation_ongoing_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t
+lttng_condition_session_rotation_ongoing_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
-ssize_t lttng_condition_session_rotation_completed_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_condition **condition);
+ssize_t
+lttng_condition_session_rotation_completed_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_condition **condition);
-struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create(
- uint64_t id);
+struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create(uint64_t id);
/* Ownership of location is transferred to the evaluation. */
-struct lttng_evaluation *lttng_evaluation_session_rotation_completed_create(
- uint64_t id,
- struct lttng_trace_archive_location *location);
+struct lttng_evaluation *
+lttng_evaluation_session_rotation_completed_create(uint64_t id,
+ struct lttng_trace_archive_location *location);
-ssize_t lttng_evaluation_session_rotation_ongoing_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_evaluation **evaluation);
+ssize_t
+lttng_evaluation_session_rotation_ongoing_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_evaluation **evaluation);
ssize_t lttng_evaluation_session_rotation_completed_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_evaluation **evaluation);
+ struct lttng_payload_view *view, struct lttng_evaluation **evaluation);
#endif /* LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H */
#ifndef LTTNG_CONDITION_SESSION_ROTATION_H
#define LTTNG_CONDITION_SESSION_ROTATION_H
-#include <lttng/condition/evaluation.h>
#include <lttng/condition/condition.h>
-#include <stdint.h>
+#include <lttng/condition/evaluation.h>
#include <lttng/domain.h>
#include <lttng/location.h>
#include <lttng/lttng-export.h>
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* Returns a new condition on success, NULL on failure. This condition must be
* destroyed using lttng_condition_destroy().
*/
-LTTNG_EXPORT extern struct lttng_condition *
-lttng_condition_session_rotation_ongoing_create(void);
+LTTNG_EXPORT extern struct lttng_condition *lttng_condition_session_rotation_ongoing_create(void);
/*
* Create a newly allocated session rotation completion condition.
* Returns a new condition on success, NULL on failure. This condition must be
* destroyed using lttng_condition_destroy().
*/
-LTTNG_EXPORT extern struct lttng_condition *
-lttng_condition_session_rotation_completed_create(void);
+LTTNG_EXPORT extern struct lttng_condition *lttng_condition_session_rotation_completed_create(void);
/*
* Get the session name property of a session rotation condition.
* was not set prior to this call.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_session_rotation_get_session_name(
- const struct lttng_condition *condition,
- const char **session_name);
+lttng_condition_session_rotation_get_session_name(const struct lttng_condition *condition,
+ const char **session_name);
/*
* Set the session name property of a session rotation condition.
* if invalid paramenters are passed.
*/
LTTNG_EXPORT extern enum lttng_condition_status
-lttng_condition_session_rotation_set_session_name(
- struct lttng_condition *condition,
- const char *session_name);
+lttng_condition_session_rotation_set_session_name(struct lttng_condition *condition,
+ const char *session_name);
/**
* lttng_evaluation_session_rotation are specialised lttng_evaluations
* passed.
*/
LTTNG_EXPORT extern enum lttng_evaluation_status
-lttng_evaluation_session_rotation_get_id(
- const struct lttng_evaluation *evaluation, uint64_t *id);
+lttng_evaluation_session_rotation_get_id(const struct lttng_evaluation *evaluation, uint64_t *id);
/*
* Get the session rotation location property of a session rotation completed
*/
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);
+ const struct lttng_evaluation *evaluation,
+ const struct lttng_trace_archive_location **location);
#ifdef __cplusplus
}
#define LTTNG_CONSTANT_H
#ifndef LTTNG_DEPRECATED
-#if defined (__GNUC__) \
- && ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) \
- || __GNUC__ >= 5)
+#if defined(__GNUC__) && ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) || __GNUC__ >= 5)
#define LTTNG_DEPRECATED(msg) __attribute__((deprecated(msg)))
#else
#define LTTNG_DEPRECATED(msg) __attribute__((deprecated))
/*
* Event symbol length. Copied from LTTng kernel ABI.
*/
-#define LTTNG_SYMBOL_NAME_LEN 256
+#define LTTNG_SYMBOL_NAME_LEN 256
/*
* PROC(5) mentions that PID_MAX_LIMIT may not exceed 2^22 on 64-bit HW.
* We prefer to use 32-bits for simplicity's sake.
*/
-#define LTTNG_MAX_PID INT32_MAX
-#define LTTNG_MAX_PID_STR "2147483647"
+#define LTTNG_MAX_PID INT32_MAX
+#define LTTNG_MAX_PID_STR "2147483647"
-#define LTTNG_NAME_MAX 255
+#define LTTNG_NAME_MAX 255
/*
* POSIX guarantees that a host name will not exceed 255 characters.
*
* 256 is used to include a trailing NULL character.
*/
-#define LTTNG_HOST_NAME_MAX 256
+#define LTTNG_HOST_NAME_MAX 256
-#define LTTNG_PATH_MAX 4096
+#define LTTNG_PATH_MAX 4096
#endif /* LTTNG_CONSTANT_H */
#ifndef LTTNG_DESTRUCTION_HANDLE_H
#define LTTNG_DESTRUCTION_HANDLE_H
-#include <lttng/rotation.h>
#include <lttng/lttng-error.h>
#include <lttng/lttng-export.h>
+#include <lttng/rotation.h>
#ifdef __cplusplus
extern "C" {
* Destroy an lttng_destruction_session handle.
* The handle should be discarded after this call.
*/
-LTTNG_EXPORT extern void lttng_destruction_handle_destroy(
- struct lttng_destruction_handle *handle);
+LTTNG_EXPORT extern void lttng_destruction_handle_destroy(struct lttng_destruction_handle *handle);
/*
* Wait for the destruction of a session to complete.
* operation completed successfully.
*/
LTTNG_EXPORT extern enum lttng_destruction_handle_status
-lttng_destruction_handle_wait_for_completion(
- struct lttng_destruction_handle *handle, int timeout_ms);
+lttng_destruction_handle_wait_for_completion(struct lttng_destruction_handle *handle,
+ int timeout_ms);
/*
* Get the result of a session destruction operation.
* invalid (e.g. NULL).
*/
LTTNG_EXPORT extern enum lttng_destruction_handle_status
-lttng_destruction_handle_get_result(
- const struct lttng_destruction_handle *handle,
- enum lttng_error_code *result);
+lttng_destruction_handle_get_result(const struct lttng_destruction_handle *handle,
+ enum lttng_error_code *result);
/*
* Get the status of the session rotation performed as part of the session's
* LTTNG_ROTATION_STATE_NO_ROTATION.
*/
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);
+lttng_destruction_handle_get_rotation_state(const struct lttng_destruction_handle *handle,
+ enum lttng_rotation_state *rotation_state);
/*
* Get the location of the archive resulting from the rotation performed during
* invalid (e.g. NULL).
*/
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);
+lttng_destruction_handle_get_archive_location(const struct lttng_destruction_handle *handle,
+ const struct lttng_trace_archive_location **location);
#ifdef __cplusplus
}
#ifndef LTTNG_DOMAIN_INTERNAL_H
#define LTTNG_DOMAIN_INTERNAL_H
-#include "lttng/domain.h"
#include "common/macros.hpp"
+#include "lttng/domain.h"
const char *lttng_domain_type_str(enum lttng_domain_type domain_type);
* Domain types: the different possible tracers.
*/
enum lttng_domain_type {
- LTTNG_DOMAIN_NONE = 0, /* No associated domain. */
- LTTNG_DOMAIN_KERNEL = 1, /* Linux Kernel tracer. */
- LTTNG_DOMAIN_UST = 2, /* Global Userspace tracer. */
- LTTNG_DOMAIN_JUL = 3, /* Java Util Logging. */
- LTTNG_DOMAIN_LOG4J = 4, /* Java Log4j Framework. */
- LTTNG_DOMAIN_PYTHON = 5, /* Python logging Framework. */
+ LTTNG_DOMAIN_NONE = 0, /* No associated domain. */
+ LTTNG_DOMAIN_KERNEL = 1, /* Linux Kernel tracer. */
+ LTTNG_DOMAIN_UST = 2, /* Global Userspace tracer. */
+ LTTNG_DOMAIN_JUL = 3, /* Java Util Logging. */
+ LTTNG_DOMAIN_LOG4J = 4, /* Java Log4j Framework. */
+ LTTNG_DOMAIN_PYTHON = 5, /* Python logging Framework. */
};
/* Buffer type for a specific domain. */
enum lttng_buffer_type {
- LTTNG_BUFFER_PER_PID, /* Only supported by UST being the default. */
- LTTNG_BUFFER_PER_UID, /* Only supported by UST. */
- LTTNG_BUFFER_GLOBAL, /* Only supported by the Kernel. */
+ LTTNG_BUFFER_PER_PID, /* Only supported by UST being the default. */
+ LTTNG_BUFFER_PER_UID, /* Only supported by UST. */
+ LTTNG_BUFFER_GLOBAL, /* Only supported by the Kernel. */
};
/*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_DOMAIN_PADDING1 12
-#define LTTNG_DOMAIN_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_DOMAIN_PADDING1 12
+#define LTTNG_DOMAIN_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
struct lttng_domain {
enum lttng_domain_type type;
enum lttng_buffer_type buf_type;
* Return the size (number of entries) of the "lttng_domain" array. Caller
* must free domains. On error, a negative LTTng error code is returned.
*/
-LTTNG_EXPORT extern int lttng_list_domains(const char *session_name,
- struct lttng_domain **domains);
+LTTNG_EXPORT extern int lttng_list_domains(const char *session_name, struct lttng_domain **domains);
#ifdef __cplusplus
}
#ifndef LTTNG_ENDPOINT_INTERNAL_H
#define LTTNG_ENDPOINT_INTERNAL_H
-#include <lttng/endpoint.h>
#include <common/macros.hpp>
+#include <lttng/endpoint.h>
+
enum lttng_endpoint_type {
LTTNG_ENDPOINT_TYPE_DEFAULT_SESSIOND_NOTIFICATION = 0,
LTTNG_ENDPOINT_TYPE_DEFAULT_SESSIOND_COMMAND = 1,
#ifndef LTTNG_ERROR_QUERY_INTERNAL_H
#define LTTNG_ERROR_QUERY_INTERNAL_H
-#include <lttng/lttng.h>
#include <common/macros.hpp>
-#include <common/payload.hpp>
#include <common/payload-view.hpp>
+#include <common/payload.hpp>
+
+#include <lttng/lttng.h>
struct mi_writer;
LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION,
};
-enum lttng_error_query_target_type lttng_error_query_get_target_type(
- const struct lttng_error_query *query);
+enum lttng_error_query_target_type
+lttng_error_query_get_target_type(const struct lttng_error_query *query);
-const struct lttng_trigger *lttng_error_query_trigger_borrow_target(
- const struct lttng_error_query *query);
+const struct lttng_trigger *
+lttng_error_query_trigger_borrow_target(const struct lttng_error_query *query);
-const struct lttng_trigger *lttng_error_query_condition_borrow_target(
- const struct lttng_error_query *query);
+const struct lttng_trigger *
+lttng_error_query_condition_borrow_target(const struct lttng_error_query *query);
-const struct lttng_trigger *lttng_error_query_action_borrow_trigger_target(
- const struct lttng_error_query *query);
+const struct lttng_trigger *
+lttng_error_query_action_borrow_trigger_target(const struct lttng_error_query *query);
-struct lttng_action *lttng_error_query_action_borrow_action_target(
- const struct lttng_error_query *query,
- struct lttng_trigger *trigger);
+struct lttng_action *
+lttng_error_query_action_borrow_action_target(const struct lttng_error_query *query,
+ struct lttng_trigger *trigger);
int lttng_error_query_serialize(const struct lttng_error_query *query,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
- struct lttng_error_query **query);
+ struct lttng_error_query **query);
-int lttng_error_query_result_serialize(
- const struct lttng_error_query_result *result,
- struct lttng_payload *payload);
+int lttng_error_query_result_serialize(const struct lttng_error_query_result *result,
+ struct lttng_payload *payload);
-ssize_t lttng_error_query_result_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_error_query_result **result);
+ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_error_query_result **result);
-int lttng_error_query_results_serialize(
- const struct lttng_error_query_results *results,
- struct lttng_payload *payload);
+int lttng_error_query_results_serialize(const struct lttng_error_query_results *results,
+ struct lttng_payload *payload);
-ssize_t lttng_error_query_results_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_error_query_results **results);
+ssize_t lttng_error_query_results_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_error_query_results **results);
struct lttng_error_query_result *
-lttng_error_query_result_counter_create(
- const char *name, const char *description, uint64_t value);
+lttng_error_query_result_counter_create(const char *name, const char *description, uint64_t value);
void lttng_error_query_result_destroy(struct lttng_error_query_result *result);
struct lttng_error_query_results *lttng_error_query_results_create();
/* Ownership of `result` is transferred on success. */
-int lttng_error_query_results_add_result(
- struct lttng_error_query_results *results,
- struct lttng_error_query_result *result);
+int lttng_error_query_results_add_result(struct lttng_error_query_results *results,
+ struct lttng_error_query_result *result);
-enum lttng_error_code lttng_error_query_results_mi_serialize(
- const struct lttng_error_query_results *results,
- struct mi_writer *writer);
+enum lttng_error_code
+lttng_error_query_results_mi_serialize(const struct lttng_error_query_results *results,
+ struct mi_writer *writer);
#endif /* LTTNG_ERROR_QUERY_INTERNAL_H */
#ifndef LTTNG_ERROR_QUERY_H
#define LTTNG_ERROR_QUERY_H
-#include <lttng/lttng.h>
#include <lttng/lttng-export.h>
+#include <lttng/lttng.h>
#include <lttng/trigger/trigger.h>
+
#include <stdint.h>
#ifdef __cplusplus
};
/* Create an error query targetting a trigger object. */
-LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_trigger_create(
- const struct lttng_trigger *trigger);
+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. */
-LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_condition_create(
- const struct lttng_trigger *trigger);
+LTTNG_EXPORT extern struct lttng_error_query *
+lttng_error_query_condition_create(const struct lttng_trigger *trigger);
/*
* Create an error query targetting an action object.
* `action_path` is copied internally. The root of the `action_path` is the
* action of `trigger`.
*/
-LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_action_create(
- const struct lttng_trigger *trigger,
- const struct lttng_action_path *action_path);
+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. */
LTTNG_EXPORT extern void lttng_error_query_destroy(struct lttng_error_query *query);
* Currently, only the `lttng_session_daemon_command_endpoint` is supported,
* see `lttng/endpoint.h`.
*/
-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);
+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. */
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);
+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. */
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);
+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. */
-LTTNG_EXPORT extern void lttng_error_query_results_destroy(
- struct lttng_error_query_results *results);
+LTTNG_EXPORT extern void
+lttng_error_query_results_destroy(struct lttng_error_query_results *results);
/* Get the type of an error query result. */
-LTTNG_EXPORT extern enum lttng_error_query_result_type lttng_error_query_result_get_type(
- const struct lttng_error_query_result *result);
+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. */
-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);
+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. */
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);
+lttng_error_query_result_get_description(const struct lttng_error_query_result *result,
+ const char **description);
/* Get the value of an error counter. */
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);
+lttng_error_query_result_counter_get_value(const struct lttng_error_query_result *result,
+ uint64_t *value);
#ifdef __cplusplus
}
#define LTTNG_EVENT_EXPR_INTERNAL_H
#include <common/macros.hpp>
+
#include <lttng/event-expr.h>
struct lttng_bytecode;
/*
* Returns whether or not `expr` is an l-value (locator value).
*/
-static inline
-bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
+static inline bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
{
LTTNG_ASSERT(expr);
return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD ||
- expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
- expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
- expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT;
+ expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
+ expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
+ expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT;
}
int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
- struct lttng_bytecode **bytecode_out);
+ struct lttng_bytecode **bytecode_out);
-enum lttng_error_code lttng_event_expr_mi_serialize(
- const struct lttng_event_expr *expression,
- struct mi_writer *writer);
+enum lttng_error_code lttng_event_expr_mi_serialize(const struct lttng_event_expr *expression,
+ struct mi_writer *writer);
#endif /* LTTNG_EVENT_EXPR_INTERNAL_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`.
*/
-LTTNG_EXPORT extern enum lttng_event_expr_type lttng_event_expr_get_type(
- const struct lttng_event_expr *expr);
+LTTNG_EXPORT extern enum lttng_event_expr_type
+lttng_event_expr_get_type(const struct lttng_event_expr *expr);
/*
* Creates an event payload field expression for the payload field named
* * There's a memory error.
* * `field_name` is `NULL`.
*/
-LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_event_payload_field_create(
- const char *field_name);
+LTTNG_EXPORT extern struct lttng_event_expr *
+lttng_event_expr_event_payload_field_create(const char *field_name);
/*
* Returns the field name of the event payload field expression `expr`,
* * The type of `expr` is not
* `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD`.
*/
-LTTNG_EXPORT extern const char *lttng_event_expr_event_payload_field_get_name(
- const struct lttng_event_expr *expr);
+LTTNG_EXPORT extern const char *
+lttng_event_expr_event_payload_field_get_name(const struct lttng_event_expr *expr);
/*
* Creates a per-channel context field expression for the per-channel
* * The type of `expr` is not
* `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`.
*/
-LTTNG_EXPORT extern const char *lttng_event_expr_channel_context_field_get_name(
- const struct lttng_event_expr *expr);
+LTTNG_EXPORT extern const char *
+lttng_event_expr_channel_context_field_get_name(const struct lttng_event_expr *expr);
/*
* Creates an application-specific context field expression for the
* * `type_name` is `NULL`.
*/
LTTNG_EXPORT extern struct lttng_event_expr *
-lttng_event_expr_app_specific_context_field_create(
- const char *provider_name, const char *type_name);
+lttng_event_expr_app_specific_context_field_create(const char *provider_name,
+ const char *type_name);
/*
* Returns the provider name of the application-specific context field
* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`.
*/
LTTNG_EXPORT extern const char *
-lttng_event_expr_app_specific_context_field_get_provider_name(
- const struct lttng_event_expr *expr);
+lttng_event_expr_app_specific_context_field_get_provider_name(const struct lttng_event_expr *expr);
/*
* Returns the type name of the application-specific context field
* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`.
*/
LTTNG_EXPORT extern const char *
-lttng_event_expr_app_specific_context_field_get_type_name(
- const struct lttng_event_expr *expr);
+lttng_event_expr_app_specific_context_field_get_type_name(const struct lttng_event_expr *expr);
/*
* Creates an array field element expression for the parent array field
* * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`
* * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT`
*/
-LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_array_field_element_create(
- struct lttng_event_expr *array_field_expr,
- unsigned int index);
+LTTNG_EXPORT extern struct lttng_event_expr *
+lttng_event_expr_array_field_element_create(struct lttng_event_expr *array_field_expr,
+ unsigned int index);
/*
* Returns the parent array field expression of the array field element
* `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT`.
*/
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_array_field_element_get_parent_expr(const struct lttng_event_expr *expr);
/*
* Sets `*index` to the index of the array field element expression
* * `index` is `NULL`.
*/
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);
+lttng_event_expr_array_field_element_get_index(const struct lttng_event_expr *expr,
+ unsigned int *index);
/*
* Returns whether or not the event expressions `expr_a` and `expr_b`
* `expr_a` and `expr_b` can be `NULL`.
*/
LTTNG_EXPORT extern bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
- const struct lttng_event_expr *expr_b);
+ const struct lttng_event_expr *expr_b);
/*
* Destroys the event expression `expr` if not `NULL`.
#ifndef LTTNG_EVENT_FIELD_VALUE_INTERNAL_H
#define LTTNG_EVENT_FIELD_VALUE_INTERNAL_H
-#include <stdint.h>
-#include <lttng/event-field-value.h>
#include <common/dynamic-array.hpp>
+#include <lttng/event-field-value.h>
+
+#include <stdint.h>
+
struct lttng_event_field_value {
enum lttng_event_field_value_type type;
};
* * `count` is `NULL`.
*/
enum lttng_event_field_value_status
-lttng_event_field_value_enum_get_label_count(
- const struct lttng_event_field_value *field_val,
- unsigned int *count);
+lttng_event_field_value_enum_get_label_count(const struct lttng_event_field_value *field_val,
+ unsigned int *count);
/*
* Returns the label at index `index` of the enumeration event field
* * `index` is greater than or equal to the label count of `field_val`,
* as returned by lttng_event_field_value_enum_get_label_count().
*/
-const char *lttng_event_field_value_enum_get_label_at_index(
- const struct lttng_event_field_value *field_val,
- unsigned int index);
+const char *
+lttng_event_field_value_enum_get_label_at_index(const struct lttng_event_field_value *field_val,
+ unsigned int index);
-struct lttng_event_field_value *lttng_event_field_value_uint_create(
- uint64_t val);
+struct lttng_event_field_value *lttng_event_field_value_uint_create(uint64_t val);
-struct lttng_event_field_value *lttng_event_field_value_int_create(
- int64_t val);
+struct lttng_event_field_value *lttng_event_field_value_int_create(int64_t val);
-struct lttng_event_field_value *lttng_event_field_value_enum_uint_create(
- uint64_t val);
+struct lttng_event_field_value *lttng_event_field_value_enum_uint_create(uint64_t val);
-struct lttng_event_field_value *lttng_event_field_value_enum_int_create(
- int64_t val);
+struct lttng_event_field_value *lttng_event_field_value_enum_int_create(int64_t val);
struct lttng_event_field_value *lttng_event_field_value_real_create(double val);
-struct lttng_event_field_value *lttng_event_field_value_string_create(
- const char *val);
+struct lttng_event_field_value *lttng_event_field_value_string_create(const char *val);
-struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(
- const char *val, size_t size);
+struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(const char *val,
+ size_t size);
struct lttng_event_field_value *lttng_event_field_value_array_create();
-int lttng_event_field_value_enum_append_label(
- struct lttng_event_field_value *field_val, const char *label);
+int lttng_event_field_value_enum_append_label(struct lttng_event_field_value *field_val,
+ const char *label);
-int lttng_event_field_value_enum_append_label_with_size(
- struct lttng_event_field_value *field_val, const char *label,
- size_t size);
+int lttng_event_field_value_enum_append_label_with_size(struct lttng_event_field_value *field_val,
+ const char *label,
+ size_t size);
-int lttng_event_field_value_array_append(
- struct lttng_event_field_value *array_field_val,
- struct lttng_event_field_value *field_val);
+int lttng_event_field_value_array_append(struct lttng_event_field_value *array_field_val,
+ struct lttng_event_field_value *field_val);
int lttng_event_field_value_array_append_unavailable(
- struct lttng_event_field_value *array_field_val);
+ struct lttng_event_field_value *array_field_val);
void lttng_event_field_value_destroy(struct lttng_event_field_value *field_val);
#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`.
*/
-LTTNG_EXPORT extern enum lttng_event_field_value_type lttng_event_field_value_get_type(
- const struct lttng_event_field_value *field_val);
+LTTNG_EXPORT extern enum lttng_event_field_value_type
+lttng_event_field_value_get_type(const struct lttng_event_field_value *field_val);
/*
* Sets `*val` to the raw value of the unsigned integer/enumeration
* * `val` is `NULL`.
*/
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_unsigned_int_get_value(const struct lttng_event_field_value *field_val,
+ uint64_t *val);
/*
* Sets `*val` to the raw value of the signed integer/enumeration event
* * `val` is `NULL`.
*/
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_signed_int_get_value(const struct lttng_event_field_value *field_val,
+ int64_t *val);
/*
* Sets `*val` to the raw value of the real event field value
* * `val` is `NULL`.
*/
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);
+lttng_event_field_value_real_get_value(const struct lttng_event_field_value *field_val,
+ double *val);
/*
* Returns the raw value (an UTF-8 C string) of the string event field
* `LTTNG_EVENT_FIELD_VALUE_TYPE_STRING`.
*/
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_string_get_value(const struct lttng_event_field_value *field_val,
+ const char **value);
/*
* Sets `*length` to the length (the number of contained elements) of
* * `length` is `NULL`.
*/
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);
+lttng_event_field_value_array_get_length(const struct lttng_event_field_value *field_val,
+ unsigned int *length);
/*
* Sets `*elem_field_val` to the event field value at index `index` in
*/
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,
- const struct lttng_event_field_value **elem_field_val);
+ const struct lttng_event_field_value *field_val,
+ unsigned int index,
+ const struct lttng_event_field_value **elem_field_val);
#ifdef __cplusplus
}
#define LTTNG_EVENT_INTERNAL_H
#include <common/macros.hpp>
+
#include <lttng/event.h>
#include <lttng/lttng-error.h>
struct lttng_event_exclusion_comm {
/* Includes terminator `\0`. */
uint32_t len;
- char payload [];
+ char payload[];
} LTTNG_PACKED;
struct lttng_event_probe_attr_comm {
struct lttng_event *lttng_event_copy(const struct lttng_event *event);
ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
- struct lttng_event **out_event,
- struct lttng_event_exclusion **out_exclusion,
- char **out_filter_expression,
- struct lttng_bytecode **out_bytecode);
+ struct lttng_event **out_event,
+ struct lttng_event_exclusion **out_exclusion,
+ char **out_filter_expression,
+ struct lttng_bytecode **out_bytecode);
int lttng_event_serialize(const struct lttng_event *event,
- unsigned int exclusion_count,
- char **exclusion_list,
- char *filter_expression,
- size_t bytecode_len,
- struct lttng_bytecode *bytecode,
- struct lttng_payload *payload);
+ unsigned int exclusion_count,
+ char **exclusion_list,
+ char *filter_expression,
+ size_t bytecode_len,
+ struct lttng_bytecode *bytecode,
+ struct lttng_payload *payload);
-ssize_t lttng_event_context_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_context **event_ctx);
+ssize_t lttng_event_context_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_context **event_ctx);
int lttng_event_context_serialize(struct lttng_event_context *context,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
void lttng_event_context_destroy(struct lttng_event_context *context);
-enum lttng_error_code lttng_events_create_and_flatten_from_payload(
- struct lttng_payload_view *view,
- unsigned int count,
- struct lttng_event **events);
+enum lttng_error_code lttng_events_create_and_flatten_from_payload(struct lttng_payload_view *view,
+ unsigned int count,
+ struct lttng_event **events);
-ssize_t lttng_event_field_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_field **field);
+ssize_t lttng_event_field_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_field **field);
int lttng_event_field_serialize(const struct lttng_event_field *field,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
enum lttng_error_code lttng_event_fields_create_and_flatten_from_payload(
- struct lttng_payload_view *view,
- unsigned int count,
- struct lttng_event_field **fields);
+ struct lttng_payload_view *view, unsigned int count, struct lttng_event_field **fields);
#endif /* LTTNG_EVENT_INTERNAL_H */
#ifndef LTTNG_EVENT_RULE_INTERNAL_H
#define LTTNG_EVENT_RULE_INTERNAL_H
-#include <common/macros.hpp>
#include <common/credentials.hpp>
+#include <common/macros.hpp>
#include <common/sessiond-comm/sessiond-comm.hpp>
+
#include <lttng/domain.h>
-#include <lttng/event.h>
#include <lttng/event-rule/event-rule.h>
+#include <lttng/event.h>
#include <lttng/lttng-error.h>
+
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
char payload[];
};
-void lttng_event_rule_init(struct lttng_event_rule *event_rule,
- enum lttng_event_rule_type type);
+void lttng_event_rule_init(struct lttng_event_rule *event_rule, enum lttng_event_rule_type type);
bool lttng_event_rule_validate(const struct lttng_event_rule *event_rule);
-ssize_t lttng_event_rule_create_from_payload(
- struct lttng_payload_view *payload,
- struct lttng_event_rule **event_rule);
+ssize_t lttng_event_rule_create_from_payload(struct lttng_payload_view *payload,
+ struct lttng_event_rule **event_rule);
int lttng_event_rule_serialize(const struct lttng_event_rule *event_rule,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
-bool lttng_event_rule_is_equal(const struct lttng_event_rule *a,
- const struct lttng_event_rule *b);
+bool lttng_event_rule_is_equal(const struct lttng_event_rule *a, const struct lttng_event_rule *b);
bool lttng_event_rule_get(struct lttng_event_rule *rule);
void lttng_event_rule_put(struct lttng_event_rule *rule);
-enum lttng_domain_type lttng_event_rule_get_domain_type(
- const struct lttng_event_rule *rule);
+enum lttng_domain_type lttng_event_rule_get_domain_type(const struct lttng_event_rule *rule);
-enum lttng_error_code lttng_event_rule_generate_filter_bytecode(
- struct lttng_event_rule *rule,
- const struct lttng_credentials *creds);
+enum lttng_error_code
+lttng_event_rule_generate_filter_bytecode(struct lttng_event_rule *rule,
+ const struct lttng_credentials *creds);
/*
* If not present/implemented returns NULL.
* If not present/implemented returns NULL.
* Caller DOES NOT own the returned object.
*/
-const struct lttng_bytecode *lttng_event_rule_get_filter_bytecode(
- const struct lttng_event_rule *rule);
+const struct lttng_bytecode *
+lttng_event_rule_get_filter_bytecode(const struct lttng_event_rule *rule);
/*
* If not present/implemented return NULL.
*/
enum lttng_event_rule_generate_exclusions_status
lttng_event_rule_generate_exclusions(const struct lttng_event_rule *rule,
- struct lttng_event_exclusion **exclusions);
+ struct lttng_event_exclusion **exclusions);
const char *lttng_event_rule_type_str(enum lttng_event_rule_type type);
*
* The caller owns the returned object.
*/
-struct lttng_event *lttng_event_rule_generate_lttng_event(
- const struct lttng_event_rule *rule);
+struct lttng_event *lttng_event_rule_generate_lttng_event(const struct lttng_event_rule *rule);
/* Test if an event rule targets an agent domain. */
bool lttng_event_rule_targets_agent_domain(const struct lttng_event_rule *rule);
-enum lttng_error_code lttng_event_rule_mi_serialize(
- const struct lttng_event_rule *rule, struct mi_writer *writer);
+enum lttng_error_code lttng_event_rule_mi_serialize(const struct lttng_event_rule *rule,
+ struct mi_writer *writer);
#endif /* LTTNG_EVENT_RULE_INTERNAL_H */
* Returns the type of an event rule on success, LTTNG_EVENT_RULE_UNKNOWN on
* error.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_type lttng_event_rule_get_type(
- const struct lttng_event_rule *event_rule);
+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.
#ifndef LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H
#define LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/jul-logging.h>
#include <lttng/event.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_jul_logging_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_jul_logging_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
#endif /* LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H */
#define LTTNG_EVENT_RULE_JUL_LOGGING_H
#include <lttng/event-rule/event-rule.h>
+#include <lttng/event.h>
#include <lttng/log-level-rule.h>
#include <lttng/lttng-export.h>
-#include <lttng/event.h>
#ifdef __cplusplus
extern "C" {
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_name_pattern(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name pattern of a jul logging event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
* was not set prior to this call.
*/
-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);
+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);
/*
* Set the filter expression of a jul logging event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter(
- struct lttng_event_rule *rule, const char *expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_jul_logging_set_filter(struct lttng_event_rule *rule, const char *expression);
/*
* Get the filter expression of a jul logging event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
* was not set prior to this call.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter(
- const struct lttng_event_rule *rule, const char **expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_jul_logging_get_filter(const struct lttng_event_rule *rule,
+ const char **expression);
/*
* Set the log level rule of a jul logging event rule.
*/
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);
+ const struct lttng_log_level_rule *log_level_rule);
/*
* Get the log level rule of a jul logging event rule.
* to this call.
*/
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);
+lttng_event_rule_jul_logging_get_log_level_rule(const struct lttng_event_rule *rule,
+ const struct lttng_log_level_rule **log_level_rule);
#ifdef __cplusplus
}
#ifndef LTTNG_EVENT_RULE_KERNEL_KPROBE_INTERNAL_H
#define LTTNG_EVENT_RULE_KERNEL_KPROBE_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/kernel-kprobe.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(
- struct lttng_payload_view *payload,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(struct lttng_payload_view *payload,
+ struct lttng_event_rule **rule);
#endif /* LTTNG_EVENT_RULE_KERNEL_KPROBE_INTERNAL_H */
* Returns a new event rule on success, NULL on failure. The returned event rule
* must be destroyed using lttng_event_rule_destroy().
*/
-LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create(
- const struct lttng_kernel_probe_location *location);
+LTTNG_EXPORT extern struct lttng_event_rule *
+lttng_event_rule_kernel_kprobe_create(const struct lttng_kernel_probe_location *location);
/*
* Get the kernel probe location of a kernel kprobe event rule.
* passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to
* this call.
*/
-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);
+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);
/*
* Set the name of a kernel kprobe event rule.
* Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_set_event_name(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name of a kernel kprobe event rule.
* 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.
*/
-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);
+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
}
#ifndef LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H
#define LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/kernel-syscall.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_kernel_syscall_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_kernel_syscall_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
const char *lttng_event_rule_kernel_syscall_emission_site_str(
- enum lttng_event_rule_kernel_syscall_emission_site emission_site);
+ enum lttng_event_rule_kernel_syscall_emission_site emission_site);
#endif /* LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H */
* Returns a new event rule on success, NULL on failure. This event rule must be
* destroyed using lttng_event_rule_destroy().
*/
-LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(enum
- lttng_event_rule_kernel_syscall_emission_site emission_site);
+LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(
+ enum lttng_event_rule_kernel_syscall_emission_site emission_site);
/*
* Set the name pattern of a kernel syscall event rule.
* Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pattern(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name pattern of a kernel syscall event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
* was not set prior to this call.
*/
-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);
+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);
/*
* Set the filter expression of a kernel syscall event rule.
* Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter(
- struct lttng_event_rule *rule, const char *expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_kernel_syscall_set_filter(struct lttng_event_rule *rule, const char *expression);
/*
* Get the filter expression of a kernel syscall event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
* was not set prior to this call.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter(
- const struct lttng_event_rule *rule, const char **expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_kernel_syscall_get_filter(const struct lttng_event_rule *rule,
+ const char **expression);
/*
* Get the emission site of a kernel syscall event rule.
* Returns a 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);
+lttng_event_rule_kernel_syscall_get_emission_site(const struct lttng_event_rule *rule);
#ifdef __cplusplus
}
#ifndef LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_INTERNAL_H
#define LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/kernel-tracepoint.h>
#include <lttng/event.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
#endif /* LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_INTERNAL_H */
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_pattern(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name pattern of a kernel tracepoint event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
* was not set prior to this call.
*/
-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);
+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);
/*
* Set the filter expression of a kernel tracepoint event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filter(
- struct lttng_event_rule *rule, const char *expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_kernel_tracepoint_set_filter(struct lttng_event_rule *rule,
+ const char *expression);
/*
* Get the filter expression of a kernel tracepoint event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
* was not set prior to this call.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter(
- const struct lttng_event_rule *rule, const char **expression);
+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
}
#ifndef LTTNG_EVENT_RULE_KERNEL_UPROBE_INTERNAL_H
#define LTTNG_EVENT_RULE_KERNEL_UPROBE_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/kernel-uprobe.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
struct lttng_userspace_probe_location *
-lttng_event_rule_kernel_uprobe_get_location_mutable(
- const struct lttng_event_rule *rule);
+lttng_event_rule_kernel_uprobe_get_location_mutable(const struct lttng_event_rule *rule);
#endif /* LTTNG_EVENT_RULE_KERNEL_UPROBE_INTERNAL_H */
* Returns a new event rule on success, NULL on failure. This event rule must be
* destroyed using lttng_event_rule_destroy().
*/
-LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create(
- const struct lttng_userspace_probe_location *location);
+LTTNG_EXPORT extern struct lttng_event_rule *
+lttng_event_rule_kernel_uprobe_create(const struct lttng_userspace_probe_location *location);
/*
* Get the location of a kernel uprobe event rule.
* passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to
* this call.
*/
-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);
+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);
/*
* Set the name of a kernel uprobe event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_set_event_name(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name of a kernel uprobe event rule.
* 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.
*/
-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);
+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
}
#ifndef LTTNG_EVENT_RULE_LOG4J_LOGGING_INTERNAL_H
#define LTTNG_EVENT_RULE_LOG4J_LOGGING_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/log4j-logging.h>
#include <lttng/event.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_log4j_logging_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_log4j_logging_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
#endif /* LTTNG_EVENT_RULE_LOG4J_LOGGING_INTERNAL_H */
#define LTTNG_EVENT_RULE_LOG4J_LOGGING_H
#include <lttng/event-rule/event-rule.h>
+#include <lttng/event.h>
#include <lttng/log-level-rule.h>
#include <lttng/lttng-export.h>
-#include <lttng/event.h>
#ifdef __cplusplus
extern "C" {
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_name_pattern(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name pattern of a log4j logging event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
* was not set prior to this call.
*/
-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);
+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);
/*
* Set the filter expression of a log4j logging event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_filter(
- struct lttng_event_rule *rule, const char *expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_set_filter(struct lttng_event_rule *rule, const char *expression);
/*
* Get the filter expression of a log4j logging event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
* was not set prior to this call.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter(
- const struct lttng_event_rule *rule, const char **expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_get_filter(const struct lttng_event_rule *rule,
+ const char **expression);
/*
* Set the log level rule of a log4j logging event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-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);
+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);
/*
* Get the log level rule of a log4j logging event rule.
* is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior
* to this call.
*/
-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);
+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);
#ifdef __cplusplus
}
#ifndef LTTNG_EVENT_RULE_PYTHON_LOGGING_INTERNAL_H
#define LTTNG_EVENT_RULE_PYTHON_LOGGING_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/python-logging.h>
#include <lttng/event.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_python_logging_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_python_logging_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
#endif /* LTTNG_EVENT_RULE_PYTHON_LOGGING_INTERNAL_H */
#define LTTNG_EVENT_RULE_PYTHON_LOGGING_H
#include <lttng/event-rule/event-rule.h>
+#include <lttng/event.h>
#include <lttng/log-level-rule.h>
#include <lttng/lttng-export.h>
-#include <lttng/event.h>
#ifdef __cplusplus
extern "C" {
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_name_pattern(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name pattern of a python logging event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
* was not set prior to this call.
*/
-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);
+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);
/*
* Set the filter expression of a python logging event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_filter(
- struct lttng_event_rule *rule, const char *expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_python_logging_set_filter(struct lttng_event_rule *rule, const char *expression);
/*
* Get the filter expression of a python logging event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
* was not set prior to this call.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter(
- const struct lttng_event_rule *rule, const char **expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_python_logging_get_filter(const struct lttng_event_rule *rule,
+ const char **expression);
/*
* Set the log level rule of a python logging event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-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);
+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);
/*
* Get the log level rule of a python logging event rule.
* is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior
* to this call.
*/
-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);
+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);
#ifdef __cplusplus
}
#ifndef LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H
#define LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H
-#include <common/payload-view.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+#include <common/payload-view.hpp>
+
#include <lttng/domain.h>
#include <lttng/event-rule/event-rule-internal.hpp>
#include <lttng/event-rule/user-tracepoint.h>
char payload[];
} LTTNG_PACKED;
-ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_event_rule **rule);
+ssize_t lttng_event_rule_user_tracepoint_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_event_rule **rule);
#endif /* LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H */
#include <lttng/domain.h>
#include <lttng/event-rule/event-rule.h>
+#include <lttng/event.h>
#include <lttng/log-level-rule.h>
#include <lttng/lttng-export.h>
-#include <lttng/event.h>
#ifdef __cplusplus
extern "C" {
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pattern(
- struct lttng_event_rule *rule, const char *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);
/*
* Get the name pattern of a user tracepoint event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
* was not set prior to this call.
*/
-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);
+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);
/*
* Set the filter expression of a user tracepoint event rule.
* Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
* if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter(
- struct lttng_event_rule *rule, const char *expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_set_filter(struct lttng_event_rule *rule, const char *expression);
/*
* Get the filter expression of a user tracepoint event rule.
* parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
* was not set prior to this call.
*/
-LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter(
- const struct lttng_event_rule *rule, const char **expression);
+LTTNG_EXPORT extern enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_get_filter(const struct lttng_event_rule *rule,
+ const char **expression);
/*
* Set the log level rule of a user tracepoint event rule.
* if invalid parameters are passed.
*/
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);
+lttng_event_rule_user_tracepoint_set_log_level_rule(
+ struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule);
/*
* Get the log level rule of a user tracepoint event rule.
*/
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);
+ const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule);
/*
* Add a name pattern exclusion to the set of name pattern exclusion of an event rule.
* Returns LTTNG_EVENT_RULE_STATUS_OK on success,
* LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed.
*/
-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);
+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);
/*
* Get the name pattern exclusions property count of an event rule.
*/
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);
+ const struct lttng_event_rule *rule, unsigned int *count);
/*
* Get the pattern name exclusion at the given index.
*/
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,
- const char **exclusion);
+ const struct lttng_event_rule *rule, unsigned int index, const char **exclusion);
#ifdef __cplusplus
}
* Instrumentation type of tracing event.
*/
enum lttng_event_type {
- LTTNG_EVENT_ALL = -1,
- LTTNG_EVENT_TRACEPOINT = 0,
- LTTNG_EVENT_PROBE = 1,
- LTTNG_EVENT_FUNCTION = 2,
- LTTNG_EVENT_FUNCTION_ENTRY = 3,
- LTTNG_EVENT_NOOP = 4,
- LTTNG_EVENT_SYSCALL = 5,
- LTTNG_EVENT_USERSPACE_PROBE = 6,
+ LTTNG_EVENT_ALL = -1,
+ LTTNG_EVENT_TRACEPOINT = 0,
+ LTTNG_EVENT_PROBE = 1,
+ LTTNG_EVENT_FUNCTION = 2,
+ LTTNG_EVENT_FUNCTION_ENTRY = 3,
+ LTTNG_EVENT_NOOP = 4,
+ LTTNG_EVENT_SYSCALL = 5,
+ LTTNG_EVENT_USERSPACE_PROBE = 6,
};
/*
* Loglevel information.
*/
enum lttng_loglevel_type {
- LTTNG_EVENT_LOGLEVEL_ALL = 0,
- LTTNG_EVENT_LOGLEVEL_RANGE = 1,
- LTTNG_EVENT_LOGLEVEL_SINGLE = 2,
+ LTTNG_EVENT_LOGLEVEL_ALL = 0,
+ LTTNG_EVENT_LOGLEVEL_RANGE = 1,
+ LTTNG_EVENT_LOGLEVEL_SINGLE = 2,
};
/*
* Available loglevels.
*/
enum lttng_loglevel {
- LTTNG_LOGLEVEL_EMERG = 0,
- LTTNG_LOGLEVEL_ALERT = 1,
- LTTNG_LOGLEVEL_CRIT = 2,
- LTTNG_LOGLEVEL_ERR = 3,
- LTTNG_LOGLEVEL_WARNING = 4,
- LTTNG_LOGLEVEL_NOTICE = 5,
- LTTNG_LOGLEVEL_INFO = 6,
- LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7,
- LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8,
- LTTNG_LOGLEVEL_DEBUG_PROCESS = 9,
- LTTNG_LOGLEVEL_DEBUG_MODULE = 10,
- LTTNG_LOGLEVEL_DEBUG_UNIT = 11,
- LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12,
- LTTNG_LOGLEVEL_DEBUG_LINE = 13,
- LTTNG_LOGLEVEL_DEBUG = 14,
+ LTTNG_LOGLEVEL_EMERG = 0,
+ LTTNG_LOGLEVEL_ALERT = 1,
+ LTTNG_LOGLEVEL_CRIT = 2,
+ LTTNG_LOGLEVEL_ERR = 3,
+ LTTNG_LOGLEVEL_WARNING = 4,
+ LTTNG_LOGLEVEL_NOTICE = 5,
+ LTTNG_LOGLEVEL_INFO = 6,
+ LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7,
+ LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8,
+ LTTNG_LOGLEVEL_DEBUG_PROCESS = 9,
+ LTTNG_LOGLEVEL_DEBUG_MODULE = 10,
+ LTTNG_LOGLEVEL_DEBUG_UNIT = 11,
+ LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12,
+ LTTNG_LOGLEVEL_DEBUG_LINE = 13,
+ LTTNG_LOGLEVEL_DEBUG = 14,
};
/*
* class java.util.logging.Level.
*/
enum lttng_loglevel_jul {
- LTTNG_LOGLEVEL_JUL_OFF = INT32_MAX,
- LTTNG_LOGLEVEL_JUL_SEVERE = 1000,
- LTTNG_LOGLEVEL_JUL_WARNING = 900,
- LTTNG_LOGLEVEL_JUL_INFO = 800,
- LTTNG_LOGLEVEL_JUL_CONFIG = 700,
- LTTNG_LOGLEVEL_JUL_FINE = 500,
- LTTNG_LOGLEVEL_JUL_FINER = 400,
- LTTNG_LOGLEVEL_JUL_FINEST = 300,
- LTTNG_LOGLEVEL_JUL_ALL = INT32_MIN,
+ LTTNG_LOGLEVEL_JUL_OFF = INT32_MAX,
+ LTTNG_LOGLEVEL_JUL_SEVERE = 1000,
+ LTTNG_LOGLEVEL_JUL_WARNING = 900,
+ LTTNG_LOGLEVEL_JUL_INFO = 800,
+ LTTNG_LOGLEVEL_JUL_CONFIG = 700,
+ LTTNG_LOGLEVEL_JUL_FINE = 500,
+ LTTNG_LOGLEVEL_JUL_FINER = 400,
+ LTTNG_LOGLEVEL_JUL_FINEST = 300,
+ LTTNG_LOGLEVEL_JUL_ALL = INT32_MIN,
};
/*
* class org.apache.log4j.Level.
*/
enum lttng_loglevel_log4j {
- LTTNG_LOGLEVEL_LOG4J_OFF = INT32_MAX,
- LTTNG_LOGLEVEL_LOG4J_FATAL = 50000,
- LTTNG_LOGLEVEL_LOG4J_ERROR = 40000,
- LTTNG_LOGLEVEL_LOG4J_WARN = 30000,
- LTTNG_LOGLEVEL_LOG4J_INFO = 20000,
- LTTNG_LOGLEVEL_LOG4J_DEBUG = 10000,
- LTTNG_LOGLEVEL_LOG4J_TRACE = 5000,
- LTTNG_LOGLEVEL_LOG4J_ALL = INT32_MIN,
+ LTTNG_LOGLEVEL_LOG4J_OFF = INT32_MAX,
+ LTTNG_LOGLEVEL_LOG4J_FATAL = 50000,
+ LTTNG_LOGLEVEL_LOG4J_ERROR = 40000,
+ LTTNG_LOGLEVEL_LOG4J_WARN = 30000,
+ LTTNG_LOGLEVEL_LOG4J_INFO = 20000,
+ LTTNG_LOGLEVEL_LOG4J_DEBUG = 10000,
+ LTTNG_LOGLEVEL_LOG4J_TRACE = 5000,
+ LTTNG_LOGLEVEL_LOG4J_ALL = INT32_MIN,
};
/*
* Level class.
*/
enum lttng_loglevel_python {
- LTTNG_LOGLEVEL_PYTHON_CRITICAL = 50,
- LTTNG_LOGLEVEL_PYTHON_ERROR = 40,
- LTTNG_LOGLEVEL_PYTHON_WARNING = 30,
- LTTNG_LOGLEVEL_PYTHON_INFO = 20,
- LTTNG_LOGLEVEL_PYTHON_DEBUG = 10,
- LTTNG_LOGLEVEL_PYTHON_NOTSET = 0,
+ LTTNG_LOGLEVEL_PYTHON_CRITICAL = 50,
+ LTTNG_LOGLEVEL_PYTHON_ERROR = 40,
+ LTTNG_LOGLEVEL_PYTHON_WARNING = 30,
+ LTTNG_LOGLEVEL_PYTHON_INFO = 20,
+ LTTNG_LOGLEVEL_PYTHON_DEBUG = 10,
+ LTTNG_LOGLEVEL_PYTHON_NOTSET = 0,
};
/*
* LTTng consumer mode
*/
enum lttng_event_output {
- LTTNG_EVENT_SPLICE = 0,
- LTTNG_EVENT_MMAP = 1,
+ LTTNG_EVENT_SPLICE = 0,
+ LTTNG_EVENT_MMAP = 1,
};
/* Event context possible type */
enum lttng_event_context_type {
- LTTNG_EVENT_CONTEXT_PID = 0,
- LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, /* Backward compat. */
- LTTNG_EVENT_CONTEXT_PROCNAME = 2,
- LTTNG_EVENT_CONTEXT_PRIO = 3,
- LTTNG_EVENT_CONTEXT_NICE = 4,
- LTTNG_EVENT_CONTEXT_VPID = 5,
- LTTNG_EVENT_CONTEXT_TID = 6,
- LTTNG_EVENT_CONTEXT_VTID = 7,
- LTTNG_EVENT_CONTEXT_PPID = 8,
- LTTNG_EVENT_CONTEXT_VPPID = 9,
- LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10,
- LTTNG_EVENT_CONTEXT_HOSTNAME = 11,
- LTTNG_EVENT_CONTEXT_IP = 12,
- LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER = 13,
+ LTTNG_EVENT_CONTEXT_PID = 0,
+ LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, /* Backward compat. */
+ LTTNG_EVENT_CONTEXT_PROCNAME = 2,
+ LTTNG_EVENT_CONTEXT_PRIO = 3,
+ LTTNG_EVENT_CONTEXT_NICE = 4,
+ LTTNG_EVENT_CONTEXT_VPID = 5,
+ LTTNG_EVENT_CONTEXT_TID = 6,
+ LTTNG_EVENT_CONTEXT_VTID = 7,
+ LTTNG_EVENT_CONTEXT_PPID = 8,
+ LTTNG_EVENT_CONTEXT_VPPID = 9,
+ LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10,
+ LTTNG_EVENT_CONTEXT_HOSTNAME = 11,
+ LTTNG_EVENT_CONTEXT_IP = 12,
+ LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER = 13,
LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER = 14,
- LTTNG_EVENT_CONTEXT_APP_CONTEXT = 15,
- LTTNG_EVENT_CONTEXT_INTERRUPTIBLE = 16,
- LTTNG_EVENT_CONTEXT_PREEMPTIBLE = 17,
- LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE = 18,
- LTTNG_EVENT_CONTEXT_MIGRATABLE = 19,
- LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL = 20,
- LTTNG_EVENT_CONTEXT_CALLSTACK_USER = 21, /* Supported on x86_32 and x86_64 only. */
- LTTNG_EVENT_CONTEXT_CGROUP_NS = 22,
- LTTNG_EVENT_CONTEXT_IPC_NS = 23,
- LTTNG_EVENT_CONTEXT_MNT_NS = 24,
- LTTNG_EVENT_CONTEXT_NET_NS = 25,
- LTTNG_EVENT_CONTEXT_PID_NS = 26,
- LTTNG_EVENT_CONTEXT_USER_NS = 27,
- LTTNG_EVENT_CONTEXT_UTS_NS = 28,
- LTTNG_EVENT_CONTEXT_UID = 29,
- LTTNG_EVENT_CONTEXT_EUID = 30,
- LTTNG_EVENT_CONTEXT_SUID = 31,
- LTTNG_EVENT_CONTEXT_GID = 32,
- LTTNG_EVENT_CONTEXT_EGID = 33,
- LTTNG_EVENT_CONTEXT_SGID = 34,
- LTTNG_EVENT_CONTEXT_VUID = 35,
- LTTNG_EVENT_CONTEXT_VEUID = 36,
- LTTNG_EVENT_CONTEXT_VSUID = 37,
- LTTNG_EVENT_CONTEXT_VGID = 38,
- LTTNG_EVENT_CONTEXT_VEGID = 39,
- LTTNG_EVENT_CONTEXT_VSGID = 40,
- LTTNG_EVENT_CONTEXT_TIME_NS = 41,
+ LTTNG_EVENT_CONTEXT_APP_CONTEXT = 15,
+ LTTNG_EVENT_CONTEXT_INTERRUPTIBLE = 16,
+ LTTNG_EVENT_CONTEXT_PREEMPTIBLE = 17,
+ LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE = 18,
+ LTTNG_EVENT_CONTEXT_MIGRATABLE = 19,
+ LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL = 20,
+ LTTNG_EVENT_CONTEXT_CALLSTACK_USER = 21, /* Supported on x86_32 and x86_64 only. */
+ LTTNG_EVENT_CONTEXT_CGROUP_NS = 22,
+ LTTNG_EVENT_CONTEXT_IPC_NS = 23,
+ LTTNG_EVENT_CONTEXT_MNT_NS = 24,
+ LTTNG_EVENT_CONTEXT_NET_NS = 25,
+ LTTNG_EVENT_CONTEXT_PID_NS = 26,
+ LTTNG_EVENT_CONTEXT_USER_NS = 27,
+ LTTNG_EVENT_CONTEXT_UTS_NS = 28,
+ LTTNG_EVENT_CONTEXT_UID = 29,
+ LTTNG_EVENT_CONTEXT_EUID = 30,
+ LTTNG_EVENT_CONTEXT_SUID = 31,
+ LTTNG_EVENT_CONTEXT_GID = 32,
+ LTTNG_EVENT_CONTEXT_EGID = 33,
+ LTTNG_EVENT_CONTEXT_SGID = 34,
+ LTTNG_EVENT_CONTEXT_VUID = 35,
+ LTTNG_EVENT_CONTEXT_VEUID = 36,
+ LTTNG_EVENT_CONTEXT_VSUID = 37,
+ LTTNG_EVENT_CONTEXT_VGID = 38,
+ LTTNG_EVENT_CONTEXT_VEGID = 39,
+ LTTNG_EVENT_CONTEXT_VSGID = 40,
+ LTTNG_EVENT_CONTEXT_TIME_NS = 41,
};
enum lttng_event_field_type {
- LTTNG_EVENT_FIELD_OTHER = 0,
- LTTNG_EVENT_FIELD_INTEGER = 1,
- LTTNG_EVENT_FIELD_ENUM = 2,
- LTTNG_EVENT_FIELD_FLOAT = 3,
- LTTNG_EVENT_FIELD_STRING = 4,
+ LTTNG_EVENT_FIELD_OTHER = 0,
+ LTTNG_EVENT_FIELD_INTEGER = 1,
+ LTTNG_EVENT_FIELD_ENUM = 2,
+ LTTNG_EVENT_FIELD_FLOAT = 3,
+ LTTNG_EVENT_FIELD_STRING = 4,
};
enum lttng_event_flag {
- LTTNG_EVENT_FLAG_SYSCALL_32 = (1U << 0),
- LTTNG_EVENT_FLAG_SYSCALL_64 = (1U << 1),
+ LTTNG_EVENT_FLAG_SYSCALL_32 = (1U << 0),
+ LTTNG_EVENT_FLAG_SYSCALL_64 = (1U << 1),
};
/*
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_PERF_EVENT_PADDING1 16
+#define LTTNG_PERF_EVENT_PADDING1 16
struct lttng_event_perf_counter_ctx {
uint32_t type;
uint64_t config;
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_EVENT_CONTEXT_PADDING1 16
-#define LTTNG_EVENT_CONTEXT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_CONTEXT_PADDING1 16
+#define LTTNG_EVENT_CONTEXT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
struct lttng_event_context {
enum lttng_event_context_type ctx;
char padding[LTTNG_EVENT_CONTEXT_PADDING1];
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_EVENT_PROBE_PADDING1 16
+#define LTTNG_EVENT_PROBE_PADDING1 16
struct lttng_event_probe_attr {
uint64_t addr;
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_EVENT_FUNCTION_PADDING1 16
+#define LTTNG_EVENT_FUNCTION_PADDING1 16
struct lttng_event_function_attr {
char symbol_name[LTTNG_SYMBOL_NAME_LEN];
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_EVENT_PADDING1 12
-#define LTTNG_EVENT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_PADDING1 12
+#define LTTNG_EVENT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
struct lttng_event {
/* Offset 0 */
enum lttng_event_type type;
int loglevel;
/* Offset 268 */
- int32_t enabled; /* Does not apply: -1 */
+ int32_t enabled; /* Does not apply: -1 */
/* Offset 272 */
pid_t pid;
/* Offset 276 */
- unsigned char filter; /* filter enabled ? */
+ unsigned char filter; /* filter enabled ? */
/* Offset 277 */
unsigned char exclusion; /* exclusions added ? */
} attr;
};
-#define LTTNG_EVENT_FIELD_PADDING LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_FIELD_PADDING LTTNG_SYMBOL_NAME_LEN + 32
struct lttng_event_field {
char field_name[LTTNG_SYMBOL_NAME_LEN];
enum lttng_event_field_type type;
* free events. On error a negative LTTng error code is returned.
*/
LTTNG_EXPORT extern int lttng_list_events(struct lttng_handle *handle,
- const char *channel_name, struct lttng_event **events);
+ const char *channel_name,
+ struct lttng_event **events);
/*
* Create an lttng_event.
*
* This destruction function, introduced in LTTng 2.11, should only
* be used with events created by lttng_event_create().
- */
+ */
LTTNG_EXPORT extern void lttng_event_destroy(struct lttng_event *event);
/*
* Returns 0 on success, or a negative LTTng error code on error.
*/
LTTNG_EXPORT extern int lttng_event_get_filter_expression(struct lttng_event *event,
- const char **filter_string);
+ const char **filter_string);
/*
* Get the number of exclusion names of a specific LTTng event.
* Returns 0 on success, or a negative LTTng error code on error.
*/
LTTNG_EXPORT extern int lttng_event_get_exclusion_name(struct lttng_event *event,
- size_t index, const char **exclusion_name);
+ size_t index,
+ const char **exclusion_name);
/*
* Get the userspace probe location of a specific LTTng event.
*
* Returns 0 on success, or a negative LTTng error code on error.
*/
-LTTNG_EXPORT extern int lttng_event_set_userspace_probe_location(struct lttng_event *event,
- struct lttng_userspace_probe_location *probe_location);
+LTTNG_EXPORT extern int
+lttng_event_set_userspace_probe_location(struct lttng_event *event,
+ struct lttng_userspace_probe_location *probe_location);
/*
* List the available tracepoints of a specific lttng domain.
* free events. On error a negative LTTng error code is returned.
*/
LTTNG_EXPORT extern int lttng_list_tracepoints(struct lttng_handle *handle,
- struct lttng_event **events);
+ struct lttng_event **events);
/*
* List the available tracepoints fields of a specific lttng domain.
* returned.
*/
LTTNG_EXPORT extern int lttng_list_tracepoint_fields(struct lttng_handle *handle,
- struct lttng_event_field **fields);
+ struct lttng_event_field **fields);
/*
* List the available kernel syscall.
* Return 0 on success else a negative LTTng error code.
*/
LTTNG_EXPORT extern int lttng_add_context(struct lttng_handle *handle,
- struct lttng_event_context *ctx, const char *event_name,
- const char *channel_name);
+ struct lttng_event_context *ctx,
+ const char *event_name,
+ const char *channel_name);
/*
* Create or enable an event (or events) for a channel.
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_enable_event(struct lttng_handle *handle,
- struct lttng_event *ev, const char *channel_name);
+LTTNG_EXPORT extern int
+lttng_enable_event(struct lttng_handle *handle, struct lttng_event *ev, const char *channel_name);
/*
* Create or enable an event with a specific filter.
* Return 0 on success else a negative LTTng error code.
*/
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);
+ struct lttng_event *event,
+ const char *channel_name,
+ const char *filter_expression);
/*
* Create or enable an event with a filter and/or exclusions.
* Return 0 on success else a negative LTTng error code.
*/
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);
+ struct lttng_event *event,
+ const char *channel_name,
+ const char *filter_expression,
+ int exclusion_count,
+ char **exclusion_names);
/*
* Disable event(s) of a channel and domain.
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_disable_event(struct lttng_handle *handle,
- const char *name, const char *channel_name);
+LTTNG_EXPORT extern int
+lttng_disable_event(struct lttng_handle *handle, const char *name, const char *channel_name);
/*
* Disable event(s) of a channel and domain.
* Return 0 on success else a negative LTTng error code.
*/
LTTNG_EXPORT extern int lttng_disable_event_ext(struct lttng_handle *handle,
- struct lttng_event *ev, const char *channel_name,
- const char *filter_expression);
+ struct lttng_event *ev,
+ const char *channel_name,
+ const char *filter_expression);
#ifdef __cplusplus
}
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_HANDLE_PADDING1 16
+#define LTTNG_HANDLE_PADDING1 16
struct lttng_handle {
char session_name[LTTNG_NAME_MAX];
struct lttng_domain domain;
* lttng_destroy_handle. On error, NULL is returned.
*/
LTTNG_EXPORT extern struct lttng_handle *lttng_create_handle(const char *session_name,
- struct lttng_domain *domain);
+ struct lttng_domain *domain);
/*
* Destroy an handle that has been previously created with lttng_create_handle.
*/
LTTNG_EXPORT extern void lttng_destroy_handle(struct lttng_handle *handle);
-
#ifdef __cplusplus
}
#endif
*/
#include <common/compat/time.hpp>
+#include <common/macros.hpp>
+
+#include <lttng/health.h>
+
#include <pthread.h>
+#include <urcu/list.h>
#include <urcu/tls-compat.h>
#include <urcu/uatomic.h>
-#include <urcu/list.h>
-#include <lttng/health.h>
-#include <common/macros.hpp>
/*
* These are the value added to the current state depending of the position in
* the thread where is either waiting on a poll() or running in the code.
*/
-#define HEALTH_POLL_VALUE (1UL << 0)
-#define HEALTH_CODE_VALUE (1UL << 1)
+#define HEALTH_POLL_VALUE (1UL << 0)
+#define HEALTH_CODE_VALUE (1UL << 1)
-#define HEALTH_IS_IN_POLL(x) ((x) & HEALTH_POLL_VALUE)
+#define HEALTH_IS_IN_POLL(x) ((x) &HEALTH_POLL_VALUE)
struct health_app;
enum health_flags {
- HEALTH_ERROR = (1U << 0),
+ HEALTH_ERROR = (1U << 0),
};
struct health_state {
/*
* current and flags are updated by multiple threads concurrently.
*/
- unsigned long current; /* progress counter, updated atomically */
- enum health_flags flags; /* other flags, updated atomically */
- int type; /* Indicates the nature of the thread. */
+ unsigned long current; /* progress counter, updated atomically */
+ enum health_flags flags; /* other flags, updated atomically */
+ int type; /* Indicates the nature of the thread. */
/* Node of the global TLS state list. */
struct cds_list_head node;
};
enum health_cmd {
- HEALTH_CMD_CHECK = 0,
+ HEALTH_CMD_CHECK = 0,
};
struct health_comm_msg {
- uint32_t cmd; /* enum health_cmd */
+ uint32_t cmd; /* enum health_cmd */
} LTTNG_PACKED;
struct health_comm_reply {
- uint64_t ret_code; /* bitmask of threads in bad health */
+ uint64_t ret_code; /* bitmask of threads in bad health */
} LTTNG_PACKED;
/* Declare TLS health state. */
static inline void health_poll_entry()
{
/* Code MUST be in code execution state which is an even number. */
- LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current)
- & HEALTH_POLL_VALUE));
+ LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current) & HEALTH_POLL_VALUE));
uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE);
}
static inline void health_poll_exit()
{
/* Code MUST be in poll execution state which is an odd number. */
- LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current)
- & HEALTH_POLL_VALUE);
+ LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current) & HEALTH_POLL_VALUE);
uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE);
}
* Return a newly allocated health object, or NULL on error.
*/
LTTNG_EXPORT extern struct lttng_health *
- lttng_health_create_consumerd(enum lttng_health_consumerd consumerd);
+lttng_health_create_consumerd(enum lttng_health_consumerd consumerd);
/**
* lttng_health_create_relayd - Create relayd health object
* lttng_health_destroy() is called on @health.
*/
LTTNG_EXPORT extern const struct lttng_health_thread *
- lttng_health_get_thread(const struct lttng_health *health,
- unsigned int nth_thread);
+lttng_health_get_thread(const struct lttng_health *health, unsigned int nth_thread);
/**
* lttng_health_thread_state - Get thread health state
#include <common/fd-handle.hpp>
#include <common/macros.hpp>
-#include <lttng/lttng-error.h>
+
#include <lttng/kernel-probe.h>
#include <lttng/lttng-error.h>
+
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
uint64_t address;
};
-int lttng_kernel_probe_location_serialize(
- const struct lttng_kernel_probe_location *location,
- struct lttng_payload *payload);
+int lttng_kernel_probe_location_serialize(const struct lttng_kernel_probe_location *location,
+ struct lttng_payload *payload);
ssize_t lttng_kernel_probe_location_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_kernel_probe_location **probe_location);
+ struct lttng_payload_view *view, struct lttng_kernel_probe_location **probe_location);
-bool lttng_kernel_probe_location_is_equal(
- const struct lttng_kernel_probe_location *a,
- const struct lttng_kernel_probe_location *b);
+bool lttng_kernel_probe_location_is_equal(const struct lttng_kernel_probe_location *a,
+ const struct lttng_kernel_probe_location *b);
-struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
- const struct lttng_kernel_probe_location *location);
+struct lttng_kernel_probe_location *
+lttng_kernel_probe_location_copy(const struct lttng_kernel_probe_location *location);
-unsigned long lttng_kernel_probe_location_hash(
- const struct lttng_kernel_probe_location *location);
+unsigned long lttng_kernel_probe_location_hash(const struct lttng_kernel_probe_location *location);
-enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
- const struct lttng_kernel_probe_location *location,
- struct mi_writer *writer);
+enum lttng_error_code
+lttng_kernel_probe_location_mi_serialize(const struct lttng_kernel_probe_location *location,
+ struct mi_writer *writer);
#endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */
#define LTTNG_KERNEL_PROBE_H
#include <lttng/lttng-export.h>
+
#include <stdint.h>
#ifdef __cplusplus
struct lttng_kernel_probe_location;
enum lttng_kernel_probe_location_status {
- LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0,
+ LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0,
/* Invalid parameters provided. */
- LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1,
+ LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1,
};
enum lttng_kernel_probe_location_type {
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1,
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1,
/* Location derived from a symbol and an offset. */
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0,
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0,
/* Location derived from an address. */
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1,
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1,
};
/*
* Get the type of the kernel probe location.
*/
LTTNG_EXPORT extern enum lttng_kernel_probe_location_type
-lttng_kernel_probe_location_get_type(
- const struct lttng_kernel_probe_location *location);
+lttng_kernel_probe_location_get_type(const struct lttng_kernel_probe_location *location);
/*
* Destroy the kernel probe location.
*/
-LTTNG_EXPORT extern void lttng_kernel_probe_location_destroy(
- struct lttng_kernel_probe_location *location);
+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.
*/
LTTNG_EXPORT extern struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_symbol_create(const char *symbol_name,
- uint64_t offset);
+lttng_kernel_probe_location_symbol_create(const char *symbol_name, uint64_t offset);
/*
* Get the symbol name of a symbol derived probe location.
*/
-LTTNG_EXPORT extern const char *lttng_kernel_probe_location_symbol_get_name(
- const struct lttng_kernel_probe_location *location);
+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.
*/
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);
+lttng_kernel_probe_location_symbol_get_offset(const struct lttng_kernel_probe_location *location,
+ uint64_t *offset);
/*
* Create an address derived probe location.
* Get the address of an address derived probe location.
*/
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);
+lttng_kernel_probe_location_address_get_address(const struct lttng_kernel_probe_location *location,
+ uint64_t *offset);
#ifdef __cplusplus
}
#ifndef LTTNG_LOAD_INTERNAL_ABI_H
#define LTTNG_LOAD_INTERNAL_ABI_H
-#include <limits.h>
-#include <stdint.h>
+#include <common/config/session-config.hpp>
+#include <common/macros.hpp>
#include <lttng/constant.h>
-#include <common/macros.hpp>
-#include <common/config/session-config.hpp>
+
+#include <limits.h>
+#include <stdint.h>
/*
* Object used by the load_session API. This is opaque to the public library.
*/
LTTNG_EXPORT extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr);
-
/*
* Load session attribute getter family of functions.
*/
/* Return session name. NULL indicates all sessions must be loaded. */
-LTTNG_EXPORT extern const char *lttng_load_session_attr_get_session_name(
- struct lttng_load_session_attr *attr);
+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.
*/
-LTTNG_EXPORT extern const char *lttng_load_session_attr_get_input_url(
- struct lttng_load_session_attr *attr);
+LTTNG_EXPORT extern const char *
+lttng_load_session_attr_get_input_url(struct lttng_load_session_attr *attr);
/*
* Return the configuration overwrite attribute. This attribute indicates
* same name already exists. If such a session exists, it is destroyed before
* the replacement is loaded.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite(
- struct lttng_load_session_attr *attr);
+LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite(struct lttng_load_session_attr *attr);
/*
* Return the destination URL configuration override attribute. This attribute
*
* NULL indicates no override will be applied on configuration load.
*/
-LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_url(
- struct lttng_load_session_attr *attr);
+LTTNG_EXPORT extern const char *
+lttng_load_session_attr_get_override_url(struct lttng_load_session_attr *attr);
/*
* Return the configuration override control URL attribute. This attribute
*
* NULL indicates no control URL override will be applied on configuration load.
*/
-LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_ctrl_url(
- struct lttng_load_session_attr *attr);
+LTTNG_EXPORT extern const char *
+lttng_load_session_attr_get_override_ctrl_url(struct lttng_load_session_attr *attr);
/*
* Return the configuration override data URL attribute. This attribute
*
* NULL indicates no data URL override will be applied on configuration load.
*/
-LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_data_url(
- struct lttng_load_session_attr *attr);
+LTTNG_EXPORT extern const char *
+lttng_load_session_attr_get_override_data_url(struct lttng_load_session_attr *attr);
/*
* Return the configuration override session name attribute.
* NULL indicates no session name override will be applied on configuration
* load.
*/
-LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_session_name(
- struct lttng_load_session_attr *attr);
+LTTNG_EXPORT extern const char *
+lttng_load_session_attr_get_override_session_name(struct lttng_load_session_attr *attr);
/*
* Load session attribute setter family of functions.
* Set the name of the session to load. A NULL name means all sessions
* found at the input URL will be loaded.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_session_name(
- struct lttng_load_session_attr *attr, const char *session_name);
+LTTNG_EXPORT extern int
+lttng_load_session_attr_set_session_name(struct lttng_load_session_attr *attr,
+ const char *session_name);
/*
* Set the URL of the session configuration to load. A NULL value indicates the
*
* Note that file:// is the only supported URL format.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url(
- struct lttng_load_session_attr *attr, const char *url);
+LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url(struct lttng_load_session_attr *attr,
+ const char *url);
/*
* Set the overwrite attribute. If set to true, current sessions matching the
* loaded sessions will be destroyed and be replaced by the session(s) being
* loaded.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite(
- struct lttng_load_session_attr *attr, int overwrite);
+LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite(struct lttng_load_session_attr *attr,
+ int overwrite);
/*
* The following setter are for overriding sessions attributes during the
*
* See lttng-create(1) for more detail.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_override_url(
- struct lttng_load_session_attr *attr, const char *url);
+LTTNG_EXPORT extern int
+lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *attr, const char *url);
/*
* Set the control url override attribute.
*
* See lttng-create(1) for more detail.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_override_ctrl_url(
- struct lttng_load_session_attr *attr, const char *url);
+LTTNG_EXPORT extern int
+lttng_load_session_attr_set_override_ctrl_url(struct lttng_load_session_attr *attr,
+ const char *url);
/*
* Set the data url override attribute.
*
* See lttng-create(1) for more detail.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_override_data_url(
- struct lttng_load_session_attr *attr, const char *url);
+LTTNG_EXPORT extern int
+lttng_load_session_attr_set_override_data_url(struct lttng_load_session_attr *attr,
+ const char *url);
/*
* Set the session name override attribute.
* Loading a configuration file defining multiple sessions will fail if a
* session name is provided.
*/
-LTTNG_EXPORT extern int lttng_load_session_attr_set_override_session_name(
- struct lttng_load_session_attr *attr, const char *session_name);
+LTTNG_EXPORT extern int
+lttng_load_session_attr_set_override_session_name(struct lttng_load_session_attr *attr,
+ const char *session_name);
/*
* Load session configuration(s).
#ifndef LTTNG_LOCATION_INTERNAL_H
#define LTTNG_LOCATION_INTERNAL_H
-#include <lttng/location.h>
-#include <common/dynamic-buffer.hpp>
#include <common/buffer-view.hpp>
+#include <common/dynamic-buffer.hpp>
#include <common/macros.hpp>
+
+#include <lttng/location.h>
+
#include <sys/types.h>
#include <urcu/ref.h>
char payload[];
} LTTNG_PACKED;
-
-struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(
- const char *path);
+struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(const char *path);
struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
- const char *host,
- enum lttng_trace_archive_location_relay_protocol_type protocol,
- uint16_t control_port, uint16_t data_port,
- const char *relative_path);
+ const char *host,
+ enum lttng_trace_archive_location_relay_protocol_type protocol,
+ uint16_t control_port,
+ uint16_t data_port,
+ const char *relative_path);
-ssize_t lttng_trace_archive_location_create_from_buffer(
- const struct lttng_buffer_view *buffer,
- struct lttng_trace_archive_location **location);
+ssize_t
+lttng_trace_archive_location_create_from_buffer(const struct lttng_buffer_view *buffer,
+ struct lttng_trace_archive_location **location);
-ssize_t lttng_trace_archive_location_serialize(
- const struct lttng_trace_archive_location *location,
- struct lttng_dynamic_buffer *buffer);
+ssize_t lttng_trace_archive_location_serialize(const struct lttng_trace_archive_location *location,
+ struct lttng_dynamic_buffer *buffer);
-void lttng_trace_archive_location_get(
- struct lttng_trace_archive_location *location);
+void lttng_trace_archive_location_get(struct lttng_trace_archive_location *location);
-void lttng_trace_archive_location_put(
- struct lttng_trace_archive_location *location);
+void lttng_trace_archive_location_put(struct lttng_trace_archive_location *location);
#endif /* LTTNG_LOCATION_INTERNAL_H */
#define LTTNG_LOCATION_H
#include <lttng/lttng-export.h>
+
#include <stdint.h>
#ifdef __cplusplus
* Get a trace archive location's type.
*/
LTTNG_EXPORT extern enum lttng_trace_archive_location_type
-lttng_trace_archive_location_get_type(
- const struct lttng_trace_archive_location *location);
+lttng_trace_archive_location_get_type(const struct lttng_trace_archive_location *location);
/*
* Get the absolute path of a local trace archive location.
*/
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);
+ const struct lttng_trace_archive_location *location, const char **absolute_path);
/*
* Get the host address of the relay daemon associated to this trace archive
* The trace archive location maintains ownership of relay_host.
*/
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);
+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
*/
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);
+ const struct lttng_trace_archive_location *location, uint16_t *control_port);
/*
* Get the data port of the relay daemon associated to this trace archive
*/
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);
+ const struct lttng_trace_archive_location *location, uint16_t *data_port);
/*
* Get the protocol used to communicate with the relay daemon associated to this
*/
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);
+ const struct lttng_trace_archive_location *location,
+ enum lttng_trace_archive_location_relay_protocol_type *protocol);
/*
* Get path relative to the relay daemon's current output path.
*/
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);
+ const struct lttng_trace_archive_location *location, const char **relative_path);
#ifdef __cplusplus
}
#ifndef LTTNG_LOG_LEVEL_RULE_INTERNAL_H
#define LTTNG_LOG_LEVEL_RULE_INTERNAL_H
-#include <stdint.h>
-
#include <common/buffer-view.hpp>
#include <common/dynamic-array.hpp>
#include <common/macros.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
+
#include <lttng/event.h>
#include <lttng/log-level-rule.h>
#include <lttng/lttng-error.h>
+#include <stdint.h>
+
struct mi_writer;
/*
int32_t level;
};
-ssize_t lttng_log_level_rule_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_log_level_rule **rule);
+ssize_t lttng_log_level_rule_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_log_level_rule **rule);
int lttng_log_level_rule_serialize(const struct lttng_log_level_rule *rule,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
bool lttng_log_level_rule_is_equal(const struct lttng_log_level_rule *a,
- const struct lttng_log_level_rule *b);
+ const struct lttng_log_level_rule *b);
-struct lttng_log_level_rule *lttng_log_level_rule_copy(
- const struct lttng_log_level_rule *source);
+struct lttng_log_level_rule *lttng_log_level_rule_copy(const struct lttng_log_level_rule *source);
-void lttng_log_level_rule_to_loglevel(
- const struct lttng_log_level_rule *log_level_rule,
- enum lttng_loglevel_type *loglevel_type,
- int *loglevel_value);
+void lttng_log_level_rule_to_loglevel(const struct lttng_log_level_rule *log_level_rule,
+ enum lttng_loglevel_type *loglevel_type,
+ int *loglevel_value);
-unsigned long lttng_log_level_rule_hash(
- const struct lttng_log_level_rule *log_level_rule);
+unsigned long lttng_log_level_rule_hash(const struct lttng_log_level_rule *log_level_rule);
-enum lttng_error_code lttng_log_level_rule_mi_serialize(
- const struct lttng_log_level_rule *rule,
- struct mi_writer *writer);
+enum lttng_error_code lttng_log_level_rule_mi_serialize(const struct lttng_log_level_rule *rule,
+ struct mi_writer *writer);
#endif /* LTTNG_LOG_LEVEL_RULE_INTERNAL_H */
* `LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN`:
* `rule` is `NULL`.
*/
-LTTNG_EXPORT extern enum lttng_log_level_rule_type lttng_log_level_rule_get_type(
- const struct lttng_log_level_rule *rule);
+LTTNG_EXPORT extern enum lttng_log_level_rule_type
+lttng_log_level_rule_get_type(const struct lttng_log_level_rule *rule);
/*
* Creates a log level rule for which a log level must match exactly `level` to
* The returned log level rule must be destroyed using
* lttng_log_level_rule_destroy().
*/
-LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(
- int level);
+LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(int level);
/*
* Sets `level` to the level of the "exactly" log level rule `rule`.
* * `level` is NULL.
* * The type of `rule` is not `LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY`.
*/
-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);
+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);
/*
* Creates a log level rule for which a log level must be at least as severe as
* `LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS`.
*/
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);
+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`.
*/
-LTTNG_EXPORT extern void lttng_log_level_rule_destroy(
- struct lttng_log_level_rule *log_level_rule);
+LTTNG_EXPORT extern void lttng_log_level_rule_destroy(struct lttng_log_level_rule *log_level_rule);
#ifdef __cplusplus
}
#endif
enum lttng_error_code {
- LTTNG_OK = 10, /* Ok */
- LTTNG_ERR_UNK = 11, /* Unknown Error */
- LTTNG_ERR_UND = 12, /* Undefined command */
- LTTNG_ERR_SESSION_STARTED = 13, /* Session is running */
- LTTNG_ERR_UNKNOWN_DOMAIN = 14, /* Tracing domain not known */
- LTTNG_ERR_NOT_SUPPORTED = 15, /* Operation not supported */
- LTTNG_ERR_NO_SESSION = 16, /* No session found */
- LTTNG_ERR_CREATE_DIR_FAIL = 17, /* Create directory fail */
- LTTNG_ERR_SESSION_FAIL = 18, /* Create session fail */
- LTTNG_ERR_NO_SESSIOND = 19, /* No session daemon available */
- LTTNG_ERR_SET_URL = 20, /* Error setting URL */
- LTTNG_ERR_URL_EXIST = 21, /* URL already exists. */
- LTTNG_ERR_BUFFER_NOT_SUPPORTED = 22, /* Buffer type not supported. */
- LTTNG_ERR_SESS_NOT_FOUND = 23, /* Session by name not found */
- LTTNG_ERR_BUFFER_TYPE_MISMATCH = 24, /* Buffer type mismatched. */
- LTTNG_ERR_FATAL = 25, /* Fatal error */
- LTTNG_ERR_NOMEM = 26, /* Not enough memory. */
- LTTNG_ERR_SELECT_SESS = 27, /* Must select a session */
- LTTNG_ERR_EXIST_SESS = 28, /* Session name already exist */
- LTTNG_ERR_NO_EVENT = 29, /* No event found */
- LTTNG_ERR_CONNECT_FAIL = 30, /* Unable to connect to unix socket */
- LTTNG_ERR_SNAPSHOT_OUTPUT_EXIST = 31, /* Snapshot output already exists */
- LTTNG_ERR_EPERM = 32, /* Permission denied */
- LTTNG_ERR_KERN_NA = 33, /* Kernel tracer unavailable */
- LTTNG_ERR_KERN_VERSION = 34, /* Kernel tracer not compatible */
- LTTNG_ERR_KERN_EVENT_EXIST = 35, /* Kernel event already exists */
- LTTNG_ERR_KERN_SESS_FAIL = 36, /* Kernel create session failed */
- LTTNG_ERR_KERN_CHAN_EXIST = 37, /* Kernel channel already exists */
- LTTNG_ERR_KERN_CHAN_FAIL = 38, /* Kernel create channel failed */
- LTTNG_ERR_KERN_CHAN_NOT_FOUND = 39, /* Kernel channel not found */
- LTTNG_ERR_KERN_CHAN_DISABLE_FAIL = 40, /* Kernel disable channel failed */
- LTTNG_ERR_KERN_CHAN_ENABLE_FAIL = 41, /* Kernel enable channel failed */
- LTTNG_ERR_KERN_CONTEXT_FAIL = 42, /* Kernel add context failed */
- LTTNG_ERR_KERN_ENABLE_FAIL = 43, /* Kernel enable event failed */
- LTTNG_ERR_KERN_DISABLE_FAIL = 44, /* Kernel disable event failed */
- LTTNG_ERR_KERN_META_FAIL = 45, /* Kernel open metadata failed */
- LTTNG_ERR_KERN_START_FAIL = 46, /* Kernel start trace failed */
- LTTNG_ERR_KERN_STOP_FAIL = 47, /* Kernel stop trace failed */
- LTTNG_ERR_KERN_CONSUMER_FAIL = 48, /* Kernel consumer start failed */
- LTTNG_ERR_KERN_STREAM_FAIL = 49, /* Kernel create stream failed */
- LTTNG_ERR_START_SESSION_ONCE = 50, /* Session needs to be started once. */
- LTTNG_ERR_SNAPSHOT_FAIL = 51, /* Snapshot record failed. */
- LTTNG_ERR_NO_STREAM = 52, /* Index without stream on relay. */
- LTTNG_ERR_KERN_LIST_FAIL = 53, /* Kernel listing events failed */
- LTTNG_ERR_UST_CALIBRATE_FAIL = 54, /* UST calibration failed */
- LTTNG_ERR_UST_EVENT_ENABLED = 55, /* UST event already enabled. */
- LTTNG_ERR_UST_SESS_FAIL = 56, /* UST create session failed */
- LTTNG_ERR_UST_CHAN_EXIST = 57, /* UST channel already exist */
- LTTNG_ERR_UST_CHAN_FAIL = 58, /* UST create channel failed */
- LTTNG_ERR_UST_CHAN_NOT_FOUND = 59, /* UST channel not found */
- LTTNG_ERR_UST_CHAN_DISABLE_FAIL = 60, /* UST disable channel failed */
- LTTNG_ERR_UST_CHAN_ENABLE_FAIL = 61, /* UST enable channel failed */
- LTTNG_ERR_CHAN_EXIST = 62, /* Channel already exists. */
- LTTNG_ERR_UST_ENABLE_FAIL = 63, /* UST enable event failed */
- LTTNG_ERR_UST_DISABLE_FAIL = 64, /* UST disable event failed */
- LTTNG_ERR_UST_META_FAIL = 65, /* UST open metadata failed */
- LTTNG_ERR_UST_START_FAIL = 66, /* UST start trace failed */
- LTTNG_ERR_UST_STOP_FAIL = 67, /* UST stop trace failed */
- LTTNG_ERR_UST_CONSUMER64_FAIL = 68, /* 64-bit UST consumer start failed */
- LTTNG_ERR_UST_CONSUMER32_FAIL = 69, /* 32-bit UST consumer start failed */
- LTTNG_ERR_UST_STREAM_FAIL = 70, /* UST create stream failed */
- LTTNG_ERR_SNAPSHOT_NODATA = 71, /* No data in snapshot. */
- LTTNG_ERR_NO_CHANNEL = 72, /* No channel found in the session. */
- LTTNG_ERR_SESSION_INVALID_CHAR = 73, /* Invalid characters found in session name. */
- LTTNG_ERR_UST_LIST_FAIL = 74, /* UST listing events failed */
- LTTNG_ERR_UST_EVENT_EXIST = 75, /* UST event exist */
- LTTNG_ERR_UST_EVENT_NOT_FOUND = 76, /* UST event not found */
- LTTNG_ERR_UST_CONTEXT_EXIST = 77, /* UST context exist */
- LTTNG_ERR_UST_CONTEXT_INVAL = 78, /* UST context invalid */
- LTTNG_ERR_NEED_ROOT_SESSIOND = 79, /* root sessiond is needed */
- LTTNG_ERR_TRACE_ALREADY_STARTED = 80, /* Tracing already started */
- LTTNG_ERR_TRACE_ALREADY_STOPPED = 81, /* Tracing already stopped */
- LTTNG_ERR_KERN_EVENT_ENOSYS = 82, /* Kernel event type not supported */
- LTTNG_ERR_NEED_CHANNEL_NAME = 83, /* Non-default channel exists within session: channel name needs to be specified with '-c name' */
- LTTNG_ERR_NO_UST = 84, /* LTTng-UST tracer is not supported. Please rebuild lttng-tools with lttng-ust support enabled. */
- LTTNG_ERR_SAVE_FILE_EXIST = 85, /* Session file already exists. */
- LTTNG_ERR_SAVE_IO_FAIL = 86, /* IO error while writing session configuration */
- LTTNG_ERR_LOAD_INVALID_CONFIG = 87, /* Invalid session configuration */
- LTTNG_ERR_LOAD_IO_FAIL = 88, /* IO error while reading a session configuration */
- LTTNG_ERR_LOAD_SESSION_NOENT = 89, /* Session file not found */
- LTTNG_ERR_MAX_SIZE_INVALID = 90, /* Snapshot max size is invalid. */
- LTTNG_ERR_MI_OUTPUT_TYPE = 91, /* Invalid MI output format */
- LTTNG_ERR_MI_IO_FAIL = 92, /* IO error while writing machine interface output */
- LTTNG_ERR_MI_NOT_IMPLEMENTED = 93, /* Mi feature not implemented */
+ LTTNG_OK = 10, /* Ok */
+ LTTNG_ERR_UNK = 11, /* Unknown Error */
+ LTTNG_ERR_UND = 12, /* Undefined command */
+ LTTNG_ERR_SESSION_STARTED = 13, /* Session is running */
+ LTTNG_ERR_UNKNOWN_DOMAIN = 14, /* Tracing domain not known */
+ LTTNG_ERR_NOT_SUPPORTED = 15, /* Operation not supported */
+ LTTNG_ERR_NO_SESSION = 16, /* No session found */
+ LTTNG_ERR_CREATE_DIR_FAIL = 17, /* Create directory fail */
+ LTTNG_ERR_SESSION_FAIL = 18, /* Create session fail */
+ LTTNG_ERR_NO_SESSIOND = 19, /* No session daemon available */
+ LTTNG_ERR_SET_URL = 20, /* Error setting URL */
+ LTTNG_ERR_URL_EXIST = 21, /* URL already exists. */
+ LTTNG_ERR_BUFFER_NOT_SUPPORTED = 22, /* Buffer type not supported. */
+ LTTNG_ERR_SESS_NOT_FOUND = 23, /* Session by name not found */
+ LTTNG_ERR_BUFFER_TYPE_MISMATCH = 24, /* Buffer type mismatched. */
+ LTTNG_ERR_FATAL = 25, /* Fatal error */
+ LTTNG_ERR_NOMEM = 26, /* Not enough memory. */
+ LTTNG_ERR_SELECT_SESS = 27, /* Must select a session */
+ LTTNG_ERR_EXIST_SESS = 28, /* Session name already exist */
+ LTTNG_ERR_NO_EVENT = 29, /* No event found */
+ LTTNG_ERR_CONNECT_FAIL = 30, /* Unable to connect to unix socket */
+ LTTNG_ERR_SNAPSHOT_OUTPUT_EXIST = 31, /* Snapshot output already exists */
+ LTTNG_ERR_EPERM = 32, /* Permission denied */
+ LTTNG_ERR_KERN_NA = 33, /* Kernel tracer unavailable */
+ LTTNG_ERR_KERN_VERSION = 34, /* Kernel tracer not compatible */
+ LTTNG_ERR_KERN_EVENT_EXIST = 35, /* Kernel event already exists */
+ LTTNG_ERR_KERN_SESS_FAIL = 36, /* Kernel create session failed */
+ LTTNG_ERR_KERN_CHAN_EXIST = 37, /* Kernel channel already exists */
+ LTTNG_ERR_KERN_CHAN_FAIL = 38, /* Kernel create channel failed */
+ LTTNG_ERR_KERN_CHAN_NOT_FOUND = 39, /* Kernel channel not found */
+ LTTNG_ERR_KERN_CHAN_DISABLE_FAIL = 40, /* Kernel disable channel failed */
+ LTTNG_ERR_KERN_CHAN_ENABLE_FAIL = 41, /* Kernel enable channel failed */
+ LTTNG_ERR_KERN_CONTEXT_FAIL = 42, /* Kernel add context failed */
+ LTTNG_ERR_KERN_ENABLE_FAIL = 43, /* Kernel enable event failed */
+ LTTNG_ERR_KERN_DISABLE_FAIL = 44, /* Kernel disable event failed */
+ LTTNG_ERR_KERN_META_FAIL = 45, /* Kernel open metadata failed */
+ LTTNG_ERR_KERN_START_FAIL = 46, /* Kernel start trace failed */
+ LTTNG_ERR_KERN_STOP_FAIL = 47, /* Kernel stop trace failed */
+ LTTNG_ERR_KERN_CONSUMER_FAIL = 48, /* Kernel consumer start failed */
+ LTTNG_ERR_KERN_STREAM_FAIL = 49, /* Kernel create stream failed */
+ LTTNG_ERR_START_SESSION_ONCE = 50, /* Session needs to be started once. */
+ LTTNG_ERR_SNAPSHOT_FAIL = 51, /* Snapshot record failed. */
+ LTTNG_ERR_NO_STREAM = 52, /* Index without stream on relay. */
+ LTTNG_ERR_KERN_LIST_FAIL = 53, /* Kernel listing events failed */
+ LTTNG_ERR_UST_CALIBRATE_FAIL = 54, /* UST calibration failed */
+ LTTNG_ERR_UST_EVENT_ENABLED = 55, /* UST event already enabled. */
+ LTTNG_ERR_UST_SESS_FAIL = 56, /* UST create session failed */
+ LTTNG_ERR_UST_CHAN_EXIST = 57, /* UST channel already exist */
+ LTTNG_ERR_UST_CHAN_FAIL = 58, /* UST create channel failed */
+ LTTNG_ERR_UST_CHAN_NOT_FOUND = 59, /* UST channel not found */
+ LTTNG_ERR_UST_CHAN_DISABLE_FAIL = 60, /* UST disable channel failed */
+ LTTNG_ERR_UST_CHAN_ENABLE_FAIL = 61, /* UST enable channel failed */
+ LTTNG_ERR_CHAN_EXIST = 62, /* Channel already exists. */
+ LTTNG_ERR_UST_ENABLE_FAIL = 63, /* UST enable event failed */
+ LTTNG_ERR_UST_DISABLE_FAIL = 64, /* UST disable event failed */
+ LTTNG_ERR_UST_META_FAIL = 65, /* UST open metadata failed */
+ LTTNG_ERR_UST_START_FAIL = 66, /* UST start trace failed */
+ LTTNG_ERR_UST_STOP_FAIL = 67, /* UST stop trace failed */
+ LTTNG_ERR_UST_CONSUMER64_FAIL = 68, /* 64-bit UST consumer start failed */
+ LTTNG_ERR_UST_CONSUMER32_FAIL = 69, /* 32-bit UST consumer start failed */
+ LTTNG_ERR_UST_STREAM_FAIL = 70, /* UST create stream failed */
+ LTTNG_ERR_SNAPSHOT_NODATA = 71, /* No data in snapshot. */
+ LTTNG_ERR_NO_CHANNEL = 72, /* No channel found in the session. */
+ LTTNG_ERR_SESSION_INVALID_CHAR = 73, /* Invalid characters found in session name. */
+ LTTNG_ERR_UST_LIST_FAIL = 74, /* UST listing events failed */
+ LTTNG_ERR_UST_EVENT_EXIST = 75, /* UST event exist */
+ LTTNG_ERR_UST_EVENT_NOT_FOUND = 76, /* UST event not found */
+ LTTNG_ERR_UST_CONTEXT_EXIST = 77, /* UST context exist */
+ LTTNG_ERR_UST_CONTEXT_INVAL = 78, /* UST context invalid */
+ LTTNG_ERR_NEED_ROOT_SESSIOND = 79, /* root sessiond is needed */
+ LTTNG_ERR_TRACE_ALREADY_STARTED = 80, /* Tracing already started */
+ LTTNG_ERR_TRACE_ALREADY_STOPPED = 81, /* Tracing already stopped */
+ LTTNG_ERR_KERN_EVENT_ENOSYS = 82, /* Kernel event type not supported */
+ LTTNG_ERR_NEED_CHANNEL_NAME = 83, /* Non-default channel exists within session: channel name
+ needs to be specified with '-c name' */
+ LTTNG_ERR_NO_UST = 84, /* LTTng-UST tracer is not supported. Please rebuild lttng-tools with
+ lttng-ust support enabled. */
+ LTTNG_ERR_SAVE_FILE_EXIST = 85, /* Session file already exists. */
+ LTTNG_ERR_SAVE_IO_FAIL = 86, /* IO error while writing session configuration */
+ LTTNG_ERR_LOAD_INVALID_CONFIG = 87, /* Invalid session configuration */
+ LTTNG_ERR_LOAD_IO_FAIL = 88, /* IO error while reading a session configuration */
+ LTTNG_ERR_LOAD_SESSION_NOENT = 89, /* Session file not found */
+ LTTNG_ERR_MAX_SIZE_INVALID = 90, /* Snapshot max size is invalid. */
+ LTTNG_ERR_MI_OUTPUT_TYPE = 91, /* Invalid MI output format */
+ LTTNG_ERR_MI_IO_FAIL = 92, /* IO error while writing machine interface output */
+ LTTNG_ERR_MI_NOT_IMPLEMENTED = 93, /* Mi feature not implemented */
/* 94 */
/* 95 */
/* 96 */
- LTTNG_ERR_INVALID = 97, /* Invalid parameter */
- LTTNG_ERR_NO_USTCONSUMERD = 98, /* No UST consumer detected */
- LTTNG_ERR_NO_KERNCONSUMERD = 99, /* No Kernel consumer detected */
- LTTNG_ERR_EVENT_EXIST_LOGLEVEL = 100, /* Event enabled with different loglevel */
- LTTNG_ERR_URL_DATA_MISS = 101, /* Missing network data URL */
- LTTNG_ERR_URL_CTRL_MISS = 102, /* Missing network control URL */
- LTTNG_ERR_ENABLE_CONSUMER_FAIL = 103, /* Enabling consumer failed */
- LTTNG_ERR_RELAYD_CONNECT_FAIL = 104, /* lttng-relayd create session failed */
- LTTNG_ERR_RELAYD_VERSION_FAIL = 105, /* lttng-relayd not compatible */
- LTTNG_ERR_FILTER_INVAL = 106, /* Invalid filter bytecode */
- LTTNG_ERR_FILTER_NOMEM = 107, /* Lack of memory for filter bytecode */
- LTTNG_ERR_FILTER_EXIST = 108, /* Filter already exist */
- LTTNG_ERR_NO_CONSUMER = 109, /* No consumer exist for the session */
- LTTNG_ERR_EXCLUSION_INVAL = 110, /* Invalid event exclusion data */
- LTTNG_ERR_EXCLUSION_NOMEM = 111, /* Lack of memory while processing event exclusions */
- LTTNG_ERR_INVALID_EVENT_NAME = 112, /* Invalid event name */
- LTTNG_ERR_INVALID_CHANNEL_NAME = 113, /* Invalid channel name */
- LTTNG_ERR_PROCESS_ATTR_EXISTS = 114, /* Process attribute is already tracked */
+ LTTNG_ERR_INVALID = 97, /* Invalid parameter */
+ LTTNG_ERR_NO_USTCONSUMERD = 98, /* No UST consumer detected */
+ LTTNG_ERR_NO_KERNCONSUMERD = 99, /* No Kernel consumer detected */
+ LTTNG_ERR_EVENT_EXIST_LOGLEVEL = 100, /* Event enabled with different loglevel */
+ LTTNG_ERR_URL_DATA_MISS = 101, /* Missing network data URL */
+ LTTNG_ERR_URL_CTRL_MISS = 102, /* Missing network control URL */
+ LTTNG_ERR_ENABLE_CONSUMER_FAIL = 103, /* Enabling consumer failed */
+ LTTNG_ERR_RELAYD_CONNECT_FAIL = 104, /* lttng-relayd create session failed */
+ LTTNG_ERR_RELAYD_VERSION_FAIL = 105, /* lttng-relayd not compatible */
+ LTTNG_ERR_FILTER_INVAL = 106, /* Invalid filter bytecode */
+ LTTNG_ERR_FILTER_NOMEM = 107, /* Lack of memory for filter bytecode */
+ LTTNG_ERR_FILTER_EXIST = 108, /* Filter already exist */
+ LTTNG_ERR_NO_CONSUMER = 109, /* No consumer exist for the session */
+ LTTNG_ERR_EXCLUSION_INVAL = 110, /* Invalid event exclusion data */
+ LTTNG_ERR_EXCLUSION_NOMEM = 111, /* Lack of memory while processing event exclusions */
+ LTTNG_ERR_INVALID_EVENT_NAME = 112, /* Invalid event name */
+ LTTNG_ERR_INVALID_CHANNEL_NAME = 113, /* Invalid channel name */
+ LTTNG_ERR_PROCESS_ATTR_EXISTS = 114, /* Process attribute is already tracked */
LTTNG_ERR_PROCESS_ATTR_MISSING = 115, /* Process attribute was not tracked */
LTTNG_ERR_INVALID_CHANNEL_DOMAIN = 116, /* Invalid channel domain */
- LTTNG_ERR_OVERFLOW = 117, /* Overflow occurred. */
- LTTNG_ERR_SESSION_NOT_STARTED = 118, /* Session not started */
- LTTNG_ERR_LIVE_SESSION = 119, /* Live session unsupported */
- LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */
+ LTTNG_ERR_OVERFLOW = 117, /* Overflow occurred. */
+ LTTNG_ERR_SESSION_NOT_STARTED = 118, /* Session not started */
+ LTTNG_ERR_LIVE_SESSION = 119, /* Live session unsupported */
+ LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */
LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel */
- LTTNG_ERR_REGEN_STATEDUMP_FAIL = 122, /* Failed to regenerate the state dump */
- LTTNG_ERR_REGEN_STATEDUMP_NOMEM = 123, /* Failed to regenerate the state dump, not enough memory */
- LTTNG_ERR_NOT_SNAPSHOT_SESSION = 124, /* Session is not in snapshot mode. */
- LTTNG_ERR_INVALID_TRIGGER = 125, /* Invalid trigger provided. */
- LTTNG_ERR_TRIGGER_EXISTS = 126, /* Trigger already registered. */
- LTTNG_ERR_TRIGGER_NOT_FOUND = 127, /* Trigger not found. */
- LTTNG_ERR_COMMAND_CANCELLED = 128, /* Command cancelled. */
- LTTNG_ERR_ROTATION_PENDING = 129, /* Rotation already pending for this session. */
- LTTNG_ERR_ROTATION_NOT_AVAILABLE = 130, /* Rotate feature not available for this type of session (e.g: live) */
- LTTNG_ERR_ROTATION_SCHEDULE_SET = 131, /* Schedule type already set for this session. */
- LTTNG_ERR_ROTATION_SCHEDULE_NOT_SET = 132, /* No schedule of this type set for this session. */
+ LTTNG_ERR_REGEN_STATEDUMP_FAIL = 122, /* Failed to regenerate the state dump */
+ LTTNG_ERR_REGEN_STATEDUMP_NOMEM = 123, /* Failed to regenerate the state dump, not enough
+ memory */
+ LTTNG_ERR_NOT_SNAPSHOT_SESSION = 124, /* Session is not in snapshot mode. */
+ LTTNG_ERR_INVALID_TRIGGER = 125, /* Invalid trigger provided. */
+ LTTNG_ERR_TRIGGER_EXISTS = 126, /* Trigger already registered. */
+ LTTNG_ERR_TRIGGER_NOT_FOUND = 127, /* Trigger not found. */
+ LTTNG_ERR_COMMAND_CANCELLED = 128, /* Command cancelled. */
+ LTTNG_ERR_ROTATION_PENDING = 129, /* Rotation already pending for this session. */
+ LTTNG_ERR_ROTATION_NOT_AVAILABLE = 130, /* Rotate feature not available for this type of
+ session (e.g: live) */
+ LTTNG_ERR_ROTATION_SCHEDULE_SET = 131, /* Schedule type already set for this session. */
+ LTTNG_ERR_ROTATION_SCHEDULE_NOT_SET = 132, /* No schedule of this type set for this session.
+ */
LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP = 133, /* Already rotated once after a stop. */
- LTTNG_ERR_ROTATION_WRONG_VERSION = 134, /* Session rotation not supported by this kernel tracer version */
- LTTNG_ERR_NO_SESSION_OUTPUT = 135, /* Session has no output configured. */
- LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY = 136, /* Rotate feature not available on the relay. */
+ LTTNG_ERR_ROTATION_WRONG_VERSION = 134, /* Session rotation not supported by this kernel
+ tracer version */
+ LTTNG_ERR_NO_SESSION_OUTPUT = 135, /* Session has no output configured. */
+ LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY = 136, /* Rotate feature not available on the relay.
+ */
LTTNG_ERR_AGENT_TRACING_DISABLED = 137, /* Agent tracing disabled. */
- LTTNG_ERR_PROBE_LOCATION_INVAL = 138, /* Invalid userspace probe location. */
- LTTNG_ERR_ELF_PARSING = 139, /* ELF parsing error. */
- LTTNG_ERR_SDT_PROBE_SEMAPHORE = 140, /* SDT probe guarded by a semaphore. */
+ LTTNG_ERR_PROBE_LOCATION_INVAL = 138, /* Invalid userspace probe location. */
+ LTTNG_ERR_ELF_PARSING = 139, /* ELF parsing error. */
+ LTTNG_ERR_SDT_PROBE_SEMAPHORE = 140, /* SDT probe guarded by a semaphore. */
LTTNG_ERR_ROTATION_FAIL_CONSUMER = 141, /* Rotation failure on consumer */
LTTNG_ERR_ROTATE_RENAME_FAIL_CONSUMER = 142, /* Rotation rename failure on consumer */
- LTTNG_ERR_ROTATION_PENDING_LOCAL_FAIL_CONSUMER = 143, /* Rotation pending check (local) failure on consumer */
- LTTNG_ERR_ROTATION_PENDING_RELAY_FAIL_CONSUMER = 144, /* Rotation pending check (relay) failure on consumer */
- LTTNG_ERR_MKDIR_FAIL_CONSUMER = 145, /* mkdir failure on consumer */
- LTTNG_ERR_CHAN_NOT_FOUND = 146, /* Channel not found */
- LTTNG_ERR_SNAPSHOT_UNSUPPORTED = 147, /* Session configuration does not allow the use of snapshots */
- LTTNG_ERR_SESSION_NOT_EXIST = 148, /* The session does not exist on the session daemon */
- LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER = 149, /* trace chunk creation failure on consumer */
- LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER = 150, /* trace chunk close failure on consumer */
- LTTNG_ERR_TRACE_CHUNK_EXISTS_FAIL_CONSUMER = 151, /* failed to query consumer for trace chunk existence */
- LTTNG_ERR_INVALID_PROTOCOL = 152, /* a protocol error occurred */
- LTTNG_ERR_FILE_CREATION_ERROR = 153, /* failed to create a file */
- LTTNG_ERR_TIMER_STOP_ERROR = 154, /* failed to stop timer. */
- LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL = 155, /* Rotation feature not supported by the kernel tracer. */
- LTTNG_ERR_CLEAR_RELAY_DISALLOWED = 156, /* LTTng-relayd peer does not allow lttng clear command. */
- LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY = 157, /* Clearing a session is not supported by the relay daemon. */
- LTTNG_ERR_CLEAR_FAIL_CONSUMER = 158, /* Clear failure on consumer */
- LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR = 159, /* Session was already cleared since it became inactive. */
- LTTNG_ERR_USER_NOT_FOUND = 160, /* User not found. */
- LTTNG_ERR_GROUP_NOT_FOUND = 161, /* Group not found. */
- LTTNG_ERR_UNSUPPORTED_DOMAIN = 162, /* Unsupported domain used. */
- LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY = 163, /* Operation does not apply to the process attribute tracker's tracking policy */
- LTTNG_ERR_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD = 164, /* Error initializing event notifier group notification file descriptor */
+ LTTNG_ERR_ROTATION_PENDING_LOCAL_FAIL_CONSUMER = 143, /* Rotation pending check (local)
+ failure on consumer */
+ LTTNG_ERR_ROTATION_PENDING_RELAY_FAIL_CONSUMER = 144, /* Rotation pending check (relay)
+ failure on consumer */
+ LTTNG_ERR_MKDIR_FAIL_CONSUMER = 145, /* mkdir failure on consumer */
+ LTTNG_ERR_CHAN_NOT_FOUND = 146, /* Channel not found */
+ LTTNG_ERR_SNAPSHOT_UNSUPPORTED = 147, /* Session configuration does not allow the use of
+ snapshots */
+ LTTNG_ERR_SESSION_NOT_EXIST = 148, /* The session does not exist on the session daemon */
+ LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER = 149, /* trace chunk creation failure on
+ consumer */
+ LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER = 150, /* trace chunk close failure on consumer */
+ LTTNG_ERR_TRACE_CHUNK_EXISTS_FAIL_CONSUMER = 151, /* failed to query consumer for trace
+ chunk existence */
+ LTTNG_ERR_INVALID_PROTOCOL = 152, /* a protocol error occurred */
+ LTTNG_ERR_FILE_CREATION_ERROR = 153, /* failed to create a file */
+ LTTNG_ERR_TIMER_STOP_ERROR = 154, /* failed to stop timer. */
+ LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL = 155, /* Rotation feature not supported by the
+ kernel tracer. */
+ LTTNG_ERR_CLEAR_RELAY_DISALLOWED = 156, /* LTTng-relayd peer does not allow lttng clear
+ command. */
+ LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY = 157, /* Clearing a session is not supported by the
+ relay daemon. */
+ LTTNG_ERR_CLEAR_FAIL_CONSUMER = 158, /* Clear failure on consumer */
+ LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR = 159, /* Session was already cleared since it became
+ inactive. */
+ LTTNG_ERR_USER_NOT_FOUND = 160, /* User not found. */
+ LTTNG_ERR_GROUP_NOT_FOUND = 161, /* Group not found. */
+ LTTNG_ERR_UNSUPPORTED_DOMAIN = 162, /* Unsupported domain used. */
+ LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY = 163, /* Operation does not apply to
+ the process attribute
+ tracker's tracking policy
+ */
+ LTTNG_ERR_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD = 164, /* Error initializing event notifier
+ group notification file descriptor
+ */
LTTNG_ERR_INVALID_CAPTURE_EXPRESSION = 165, /* Invalid capture expression. */
- LTTNG_ERR_EVENT_NOTIFIER_REGISTRATION = 166, /* Error registering event notifier to the tracer. */
- LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING = 167, /* Error initializing event notifier error accounting. */
- LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL = 168, /* Error event notifier error accounting full. */
+ LTTNG_ERR_EVENT_NOTIFIER_REGISTRATION = 166, /* Error registering event notifier to the
+ tracer. */
+ LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING = 167, /* Error initializing event notifier error
+ accounting. */
+ LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL = 168, /* Error event notifier error
+ accounting full. */
LTTNG_ERR_INVALID_ERROR_QUERY_TARGET = 169, /* Invalid error query target. */
- LTTNG_ERR_BUFFER_FLUSH_FAILED = 170, /* Buffer flush failed */
+ LTTNG_ERR_BUFFER_FLUSH_FAILED = 170, /* Buffer flush failed */
/* MUST be last element of the manually-assigned section of the enum */
LTTNG_ERR_NR,
/* Backward-compatibility assignments */
- LTTNG_ERR_PID_TRACKED = LTTNG_ERR_PROCESS_ATTR_EXISTS, /* Backward compat alias */
- LTTNG_ERR_PID_NOT_TRACKED = LTTNG_ERR_PROCESS_ATTR_MISSING, /* Backward compat alias */
+ LTTNG_ERR_PID_TRACKED = LTTNG_ERR_PROCESS_ATTR_EXISTS, /* Backward compat alias */
+ LTTNG_ERR_PID_NOT_TRACKED = LTTNG_ERR_PROCESS_ATTR_MISSING, /* Backward compat alias */
};
/*
#ifndef LTTNG_EXPORT_H
#define LTTNG_EXPORT_H
#if defined(_WIN32) || defined(__CYGWIN__)
-# define LTTNG_EXPORT
+#define LTTNG_EXPORT
#else
-# define LTTNG_EXPORT __attribute__((visibility("default")))
+#define LTTNG_EXPORT __attribute__((visibility("default")))
#endif
#endif
#include <lttng/event-expr.h>
#include <lttng/event-field-value.h>
#include <lttng/event-rule/event-rule.h>
-#include <lttng/event-rule/log4j-logging.h>
#include <lttng/event-rule/jul-logging.h>
#include <lttng/event-rule/kernel-kprobe.h>
#include <lttng/event-rule/kernel-syscall.h>
-#include <lttng/event-rule/python-logging.h>
#include <lttng/event-rule/kernel-tracepoint.h>
#include <lttng/event-rule/kernel-uprobe.h>
+#include <lttng/event-rule/log4j-logging.h>
+#include <lttng/event-rule/python-logging.h>
#include <lttng/event-rule/user-tracepoint.h>
#include <lttng/event.h>
#include <lttng/handle.h>
#endif
enum lttng_calibrate_type {
- LTTNG_CALIBRATE_FUNCTION = 0,
+ LTTNG_CALIBRATE_FUNCTION = 0,
};
/* Machine interface output type */
enum lttng_mi_output_type {
- LTTNG_MI_XML = 1 /* XML output */
+ LTTNG_MI_XML = 1 /* XML output */
};
-#define LTTNG_CALIBRATE_PADDING1 16
+#define LTTNG_CALIBRATE_PADDING1 16
struct lttng_calibrate {
enum lttng_calibrate_type type;
* Return 0 on success else a negative LTTng error code.
*/
LTTNG_EXPORT extern int lttng_register_consumer(struct lttng_handle *handle,
- const char *socket_path);
+ const char *socket_path);
/*
* Start tracing for *all* domain(s) in the session.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
LTTNG_EXPORT extern int lttng_calibrate(struct lttng_handle *handle,
- struct lttng_calibrate *calibrate);
+ struct lttng_calibrate *calibrate);
#pragma GCC diagnostic pop
/*
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_set_consumer_url(struct lttng_handle *handle,
- const char *control_url, const char *data_url);
+LTTNG_EXPORT extern int
+lttng_set_consumer_url(struct lttng_handle *handle, const char *control_url, const char *data_url);
/*
* For a given session name, this call checks if the data is ready to be read
struct lttng_notification_channel {
using uptr = std::unique_ptr<
lttng_notification_channel,
- lttng::details::create_unique_class<lttng_notification_channel, lttng_notification_channel_destroy>::deleter>;
+ lttng::details::create_unique_class<lttng_notification_channel,
+ lttng_notification_channel_destroy>::deleter>;
pthread_mutex_t lock;
int socket;
#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.
*/
-LTTNG_EXPORT extern struct lttng_notification_channel *lttng_notification_channel_create(
- struct lttng_endpoint *endpoint);
+LTTNG_EXPORT extern struct lttng_notification_channel *
+lttng_notification_channel_create(struct lttng_endpoint *endpoint);
/*
* Get the next notification received on a notification channel.
* that caused the reception to fail.
*/
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_get_next_notification(struct lttng_notification_channel *channel,
+ struct lttng_notification **notification);
/*
* Check whether a notification is pending on a notification channel.
* provided.
*/
LTTNG_EXPORT extern enum lttng_notification_channel_status
-lttng_notification_channel_has_pending_notification(
- struct lttng_notification_channel *channel,
- bool *notification_pending);
+lttng_notification_channel_has_pending_notification(struct lttng_notification_channel *channel,
+ bool *notification_pending);
/*
* Subscribe to notifications of a condition through a notification channel.
* client was already subscribed to the condition through this channel.
*/
LTTNG_EXPORT extern enum lttng_notification_channel_status
-lttng_notification_channel_subscribe(
- struct lttng_notification_channel *channel,
- const struct lttng_condition *condition);
+lttng_notification_channel_subscribe(struct lttng_notification_channel *channel,
+ const struct lttng_condition *condition);
/*
* Unsubscribe to notifications of a condition through a notification channel.
* client was not already subscribed to the condition through this channel.
*/
LTTNG_EXPORT extern enum lttng_notification_channel_status
-lttng_notification_channel_unsubscribe(
- struct lttng_notification_channel *channel,
- const struct lttng_condition *condition);
+lttng_notification_channel_unsubscribe(struct lttng_notification_channel *channel,
+ const struct lttng_condition *condition);
/*
* Closes and destroys (frees) a notification channel.
*/
-LTTNG_EXPORT extern void lttng_notification_channel_destroy(
- struct lttng_notification_channel *channel);
+LTTNG_EXPORT extern void
+lttng_notification_channel_destroy(struct lttng_notification_channel *channel);
#ifdef __cplusplus
}
char payload[];
} LTTNG_PACKED;
-struct lttng_notification *lttng_notification_create(
- struct lttng_trigger *trigger,
- struct lttng_evaluation *evaluation);
+struct lttng_notification *lttng_notification_create(struct lttng_trigger *trigger,
+ struct lttng_evaluation *evaluation);
int lttng_notification_serialize(const struct lttng_notification *notification,
- struct lttng_payload *payload);
+ struct lttng_payload *payload);
-ssize_t lttng_notification_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_notification **notification);
+ssize_t lttng_notification_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_notification **notification);
-const struct lttng_condition *lttng_notification_get_const_condition(
- const struct lttng_notification *notification);
-const struct lttng_evaluation *lttng_notification_get_const_evaluation(
- const struct lttng_notification *notification);
+const struct lttng_condition *
+lttng_notification_get_const_condition(const struct lttng_notification *notification);
+const struct lttng_evaluation *
+lttng_notification_get_const_evaluation(const struct lttng_notification *notification);
-const struct lttng_trigger *lttng_notification_get_const_trigger(
- const struct lttng_notification *notification);
+const struct lttng_trigger *
+lttng_notification_get_const_trigger(const struct lttng_notification *notification);
#endif /* LTTNG_NOTIFICATION_INTERNAL_H */
*
* Returns an lttng_condition object on success, NULL on error.
*/
-LTTNG_EXPORT extern const struct lttng_condition *lttng_notification_get_condition(
- struct lttng_notification *notification);
+LTTNG_EXPORT extern const struct lttng_condition *
+lttng_notification_get_condition(struct lttng_notification *notification);
/*
* Get a notification's condition's evaluation.
*
* Returns an lttng_evaluation object on success, NULL on error.
*/
-LTTNG_EXPORT extern const struct lttng_evaluation *lttng_notification_get_evaluation(
- struct lttng_notification *notification);
+LTTNG_EXPORT extern const struct lttng_evaluation *
+lttng_notification_get_evaluation(struct lttng_notification *notification);
/*
* Get a notification's origin trigger.
*
* Returns an lttng_trigger object on success, NULL on error.
*/
-LTTNG_EXPORT extern const struct lttng_trigger *lttng_notification_get_trigger(
- struct lttng_notification *notification);
+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
lttng_release_func release;
};
-static inline
-void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release)
+static inline void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release)
{
LTTNG_ASSERT(ref);
ref->count = 1;
ref->release = release;
}
-static inline
-void lttng_ref_get(struct lttng_ref *ref)
+static inline void lttng_ref_get(struct lttng_ref *ref)
{
LTTNG_ASSERT(ref);
ref->count++;
LTTNG_ASSERT(ref->count);
}
-static inline
-void lttng_ref_put(struct lttng_ref *ref)
+static inline void lttng_ref_put(struct lttng_ref *ref)
{
LTTNG_ASSERT(ref);
/* Underflow check. */
#ifndef LTTNG_ROTATE_INTERNAL_ABI_H
#define LTTNG_ROTATE_INTERNAL_ABI_H
-#include <limits.h>
-#include <stdint.h>
-#include <stdbool.h>
+#include <common/macros.hpp>
#include <lttng/constant.h>
#include <lttng/rotation.h>
-#include <common/macros.hpp>
+
+#include <limits.h>
+#include <stdbool.h>
+#include <stdint.h>
/*
* Object returned by the rotate session API.
#ifndef LTTNG_ROTATION_H
#define LTTNG_ROTATION_H
-#include <stdint.h>
#include <lttng/location.h>
#include <lttng/lttng-export.h>
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* This will issue a request to the session daemon on every call. Hence,
* the result of this call may change over time.
*/
-LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_handle_get_state(
- struct lttng_rotation_handle *rotation_handle,
- enum lttng_rotation_state *rotation_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);
/*
* Get the location of the rotation's resulting archive.
* Note that location will not be set in case of error, or if the session
* rotation handle has expired.
*/
-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);
+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.
*/
-LTTNG_EXPORT extern void lttng_rotation_handle_destroy(
- struct lttng_rotation_handle *rotation_handle);
+LTTNG_EXPORT extern void
+lttng_rotation_handle_destroy(struct lttng_rotation_handle *rotation_handle);
/*
* Rotate the output folder of the session.
* LTTng error code on error.
*/
LTTNG_EXPORT extern int lttng_rotate_session(const char *session_name,
- struct lttng_rotation_immediate_descriptor *descriptor,
- struct lttng_rotation_handle **rotation_handle);
+ struct lttng_rotation_immediate_descriptor *descriptor,
+ struct lttng_rotation_handle **rotation_handle);
/*
* Get the type of a rotation schedule object.
*/
-LTTNG_EXPORT extern enum lttng_rotation_schedule_type lttng_rotation_schedule_get_type(
- const struct lttng_rotation_schedule *schedule);
+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
* LTTNG_ROTATION_STATUS_UNAVAILABLE is returned if the value is unset.
*/
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);
+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.
*/
LTTNG_EXPORT extern enum lttng_rotation_status
-lttng_rotation_schedule_size_threshold_set_threshold(
- struct lttng_rotation_schedule *schedule,
- uint64_t size_threshold_bytes);
+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.
*/
-LTTNG_EXPORT extern struct lttng_rotation_schedule *
-lttng_rotation_schedule_periodic_create(void);
+LTTNG_EXPORT extern struct lttng_rotation_schedule *lttng_rotation_schedule_periodic_create(void);
/*
* Get a time-based session rotation schedule's period.
* Returns LTTNG_ROTATION_STATUS_OK on success.
* LTTNG_ROTATION_STATUS_UNAVAILABLE is returned if the value is unset.
*/
-LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_periodic_get_period(
- const struct lttng_rotation_schedule *schedule,
- uint64_t *period_us);
+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.
*/
-LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_periodic_set_period(
- struct lttng_rotation_schedule *schedule,
- uint64_t period_us);
+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.
*/
-LTTNG_EXPORT extern void lttng_rotation_schedule_destroy(
- struct lttng_rotation_schedule *schedule);
+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.
*/
-LTTNG_EXPORT extern void lttng_rotation_schedules_destroy(
- struct lttng_rotation_schedules *schedules);
+LTTNG_EXPORT extern void
+lttng_rotation_schedules_destroy(struct lttng_rotation_schedules *schedules);
/*
* Get the number of schedules in a schedule set.
*/
-LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedules_get_count(
- const struct lttng_rotation_schedules *schedules,
- unsigned int *count);
+LTTNG_EXPORT extern enum lttng_rotation_status
+lttng_rotation_schedules_get_count(const struct lttng_rotation_schedules *schedules,
+ unsigned int *count);
/*
* Get a schedule from the set at a given index.
* Returns a rotation schedule, or NULL on error.
*/
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_schedules_get_at_index(const struct lttng_rotation_schedules *schedules,
+ unsigned int index);
/*
* Add a session rotation schedule to a session.
* LTTNG_ROTATION_STATUS_SCHEDULE_ALREADY_SET if a rotation of the same type
* is already set.
*/
-LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_add_rotation_schedule(
- const char *session_name,
- const struct lttng_rotation_schedule *schedule);
+LTTNG_EXPORT extern enum lttng_rotation_status
+lttng_session_add_rotation_schedule(const char *session_name,
+ const struct lttng_rotation_schedule *schedule);
/*
* Remove a session rotation schedule from a session.
* LTTNG_ROTATION_STATUS_SCHEDULE_INVALID if the provided schedule is
* not set.
*/
-LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_remove_rotation_schedule(
- const char *session_name,
- const struct lttng_rotation_schedule *schedule);
+LTTNG_EXPORT extern enum lttng_rotation_status
+lttng_session_remove_rotation_schedule(const char *session_name,
+ const struct lttng_rotation_schedule *schedule);
/*
* Get the rotation schedules associated with a given session.
*
* Returns LTTNG_OK on success, or a negative lttng error code on error.
*/
-LTTNG_EXPORT extern int lttng_session_list_rotation_schedules(
- const char *session_name,
- struct lttng_rotation_schedules **schedules);
+LTTNG_EXPORT extern int
+lttng_session_list_rotation_schedules(const char *session_name,
+ struct lttng_rotation_schedules **schedules);
#ifdef __cplusplus
}
#ifndef LTTNG_SAVE_INTERNAL_ABI_H
#define LTTNG_SAVE_INTERNAL_ABI_H
-#include <limits.h>
-#include <stdint.h>
+#include <common/macros.hpp>
#include <lttng/constant.h>
-#include <common/macros.hpp>
+
+#include <limits.h>
+#include <stdint.h>
/*
* Object used by the save_session API. This is opaque to the public library.
*/
LTTNG_EXPORT extern void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output);
-
/*
* Save session attribute getter family functions.
*/
/* Return session name. NULL indicated all sessions must be saved. */
-LTTNG_EXPORT extern const char *lttng_save_session_attr_get_session_name(
- struct lttng_save_session_attr *attr);
+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.
*/
-LTTNG_EXPORT extern const char *lttng_save_session_attr_get_output_url(
- struct lttng_save_session_attr *attr);
+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.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_get_overwrite(
- struct lttng_save_session_attr *attr);
+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.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_name(
- struct lttng_save_session_attr *attr);
+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.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_output(
- struct lttng_save_session_attr *attr);
+LTTNG_EXPORT extern int
+lttng_save_session_attr_get_omit_output(struct lttng_save_session_attr *attr);
/*
* Save session attribute setter family functions.
* Set the name of the session to save. A NULL name means all sessions
* known to the session daemon will be saved.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_set_session_name(
- struct lttng_save_session_attr *attr, const char *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).
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_set_output_url(
- struct lttng_save_session_attr *attr, const char *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.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_set_overwrite(
- struct lttng_save_session_attr *attr, int 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.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_name(
- struct lttng_save_session_attr *attr, int 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.
*/
-LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_output(
- struct lttng_save_session_attr *attr, int omit_output);
+LTTNG_EXPORT extern int
+lttng_save_session_attr_set_omit_output(struct lttng_save_session_attr *attr, int omit_output);
/*
* Save session configuration(s).
#ifndef LTTNG_SESSION_DESCRIPTOR_INTERNAL_H
#define LTTNG_SESSION_DESCRIPTOR_INTERNAL_H
-#include <lttng/session-descriptor.h>
-#include <lttng/lttng-error.h>
-#include <common/uri.hpp>
-#include <common/dynamic-buffer.hpp>
#include <common/buffer-view.hpp>
+#include <common/dynamic-buffer.hpp>
+#include <common/uri.hpp>
+
+#include <lttng/lttng-error.h>
+#include <lttng/session-descriptor.h>
+
#include <stdbool.h>
/* Note that these enums are used as part of the lttnctl protocol. */
LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK = 2,
};
-ssize_t lttng_session_descriptor_create_from_buffer(
- const struct lttng_buffer_view *view,
- struct lttng_session_descriptor **descriptor);
+ssize_t lttng_session_descriptor_create_from_buffer(const struct lttng_buffer_view *view,
+ struct lttng_session_descriptor **descriptor);
-int lttng_session_descriptor_serialize(
- const struct lttng_session_descriptor *descriptor,
- struct lttng_dynamic_buffer *buffer);
+int lttng_session_descriptor_serialize(const struct lttng_session_descriptor *descriptor,
+ struct lttng_dynamic_buffer *buffer);
enum lttng_session_descriptor_type
-lttng_session_descriptor_get_type(
- const struct lttng_session_descriptor *descriptor);
+lttng_session_descriptor_get_type(const struct lttng_session_descriptor *descriptor);
enum lttng_session_descriptor_output_type
-lttng_session_descriptor_get_output_type(
- const struct lttng_session_descriptor *descriptor);
+lttng_session_descriptor_get_output_type(const struct lttng_session_descriptor *descriptor);
void lttng_session_descriptor_get_local_output_uri(
- const struct lttng_session_descriptor *descriptor,
- struct lttng_uri *local_uri);
+ const struct lttng_session_descriptor *descriptor, struct lttng_uri *local_uri);
void lttng_session_descriptor_get_network_output_uris(
- const struct lttng_session_descriptor *descriptor,
- struct lttng_uri *control,
- struct lttng_uri *data);
+ const struct lttng_session_descriptor *descriptor,
+ struct lttng_uri *control,
+ struct lttng_uri *data);
unsigned long long
-lttng_session_descriptor_live_get_timer_interval(
- const struct lttng_session_descriptor *descriptor);
+lttng_session_descriptor_live_get_timer_interval(const struct lttng_session_descriptor *descriptor);
-int lttng_session_descriptor_set_session_name(
- struct lttng_session_descriptor *descriptor,
- const char *name);
+int lttng_session_descriptor_set_session_name(struct lttng_session_descriptor *descriptor,
+ const char *name);
bool lttng_session_descriptor_is_output_destination_initialized(
- const struct lttng_session_descriptor *descriptor);
+ const struct lttng_session_descriptor *descriptor);
bool lttng_session_descriptor_has_output_directory(
- const struct lttng_session_descriptor *descriptor);
+ const struct lttng_session_descriptor *descriptor);
-enum lttng_error_code lttng_session_descriptor_set_default_output(
- struct lttng_session_descriptor *descriptor,
- time_t *session_creation_time,
- const char *absolute_home_path);
+enum lttng_error_code
+lttng_session_descriptor_set_default_output(struct lttng_session_descriptor *descriptor,
+ time_t *session_creation_time,
+ const char *absolute_home_path);
-int lttng_session_descriptor_assign(
- struct lttng_session_descriptor *dst_descriptor,
- const struct lttng_session_descriptor *src_descriptor);
+int lttng_session_descriptor_assign(struct lttng_session_descriptor *dst_descriptor,
+ const struct lttng_session_descriptor *src_descriptor);
#endif /* LTTNG_SESSION_DESCRIPTOR_INTERNAL_H */
*
* Returns an lttng_session_descriptor instance on success, NULL on error.
*/
-LTTNG_EXPORT extern struct lttng_session_descriptor *
-lttng_session_descriptor_network_create(const char *name,
- const char *control_url, const char *data_url);
+LTTNG_EXPORT extern struct lttng_session_descriptor *lttng_session_descriptor_network_create(
+ const char *name, const char *control_url, const char *data_url);
/*
* Create a snapshot session descriptor without a default output.
* Returns an lttng_session_descriptor instance on success, NULL on error.
*/
LTTNG_EXPORT extern struct lttng_session_descriptor *
-lttng_session_descriptor_snapshot_local_create(const char *name,
- const char *path);
+lttng_session_descriptor_snapshot_local_create(const char *name, const char *path);
/*
* Create a snapshot session descriptor with a remote output destination.
*/
LTTNG_EXPORT extern struct lttng_session_descriptor *
lttng_session_descriptor_snapshot_network_create(const char *name,
- const char *control_url, const char *data_url);
+ const char *control_url,
+ const char *data_url);
/*
* Create a live session descriptor without an output.
* Returns an lttng_session_descriptor instance on success, NULL on error.
*/
LTTNG_EXPORT extern struct lttng_session_descriptor *
-lttng_session_descriptor_live_create(
- const char *name, unsigned long long live_timer_interval_us);
+lttng_session_descriptor_live_create(const char *name, unsigned long long live_timer_interval_us);
/*
* Create a live session descriptor with a remote output destination.
* Returns an lttng_session_descriptor instance on success, NULL on error.
*/
LTTNG_EXPORT extern struct lttng_session_descriptor *
-lttng_session_descriptor_live_network_create(
- const char *name,
- const char *control_url, const char *data_url,
- unsigned long long live_timer_interval_us);
+lttng_session_descriptor_live_network_create(const char *name,
+ const char *control_url,
+ const char *data_url,
+ unsigned long long live_timer_interval_us);
/*
* Get a session descriptor's session name.
* name parameter is unset.
*/
LTTNG_EXPORT extern enum lttng_session_descriptor_status
-lttng_session_descriptor_get_session_name(
- const struct lttng_session_descriptor *descriptor,
- const char **name);
+lttng_session_descriptor_get_session_name(const struct lttng_session_descriptor *descriptor,
+ const char **name);
/*
* Destroy a local lttng_session object.
* This does not destroy the session on the session daemon; it releases
* the resources allocated by the descriptor object.
*/
-LTTNG_EXPORT extern void lttng_session_descriptor_destroy(
- struct lttng_session_descriptor *descriptor);
+LTTNG_EXPORT extern void
+lttng_session_descriptor_destroy(struct lttng_session_descriptor *descriptor);
#ifdef __cplusplus
}
#ifndef LTTNG_SESSION_INTERNAL_H
#define LTTNG_SESSION_INTERNAL_H
-#include <lttng/constant.h>
#include <common/macros.hpp>
+#include <lttng/constant.h>
+
struct lttng_session_extended {
struct {
uint64_t value;
*
* The structures should be initialized to zero before use.
*/
-#define LTTNG_SESSION_PADDING1 8
+#define LTTNG_SESSION_PADDING1 8
struct lttng_session {
char name[LTTNG_NAME_MAX];
/*
* net://hostname/path:ctrl_port [data: data_port]
*/
char path[PATH_MAX];
- uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */
+ uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */
uint32_t snapshot_mode;
- unsigned int live_timer_interval; /* usec */
+ unsigned int live_timer_interval; /* usec */
/*
* End of public attributes.
* Returns LTTNG_OK on success. See lttng-error.h for the meaning of the other
* return codes.
*/
-LTTNG_EXPORT extern enum lttng_error_code lttng_create_session_ext(
- struct lttng_session_descriptor *session_descriptor);
+LTTNG_EXPORT extern enum lttng_error_code
+lttng_create_session_ext(struct lttng_session_descriptor *session_descriptor);
/*
* Create a tracing session using a name and an optional URL.
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *name,
- const char *snapshot_url);
+LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *name, const char *snapshot_url);
/*
* Create a session exclusively used for live reading.
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_create_session_live(const char *name, const char *url,
- unsigned int timer_interval);
+LTTNG_EXPORT extern int
+lttng_create_session_live(const char *name, const char *url, unsigned int timer_interval);
/*
* 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().
*/
-LTTNG_EXPORT extern enum lttng_error_code lttng_destroy_session_ext(const char *session_name,
- struct lttng_destruction_handle **handle);
+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
* Returns LTTNG_OK on success. See lttng-error.h for the meaning of the other
* return codes.
*/
-LTTNG_EXPORT extern enum lttng_error_code lttng_session_get_creation_time(
- const struct lttng_session *session, uint64_t *creation_time);
+LTTNG_EXPORT extern enum lttng_error_code
+lttng_session_get_creation_time(const struct lttng_session *session, uint64_t *creation_time);
/*
* Set the shared memory path for a session.
*
* Return 0 on success else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name,
- const char *shm_path);
+LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, const char *shm_path);
#ifdef __cplusplus
}
#ifndef LTTNG_SNAPSHOT_INTERNAL_ABI_H
#define LTTNG_SNAPSHOT_INTERNAL_ABI_H
+#include <common/macros.hpp>
+
+#include <lttng/constant.h>
+
#include <limits.h>
#include <stdint.h>
-#include <lttng/constant.h>
-#include <common/macros.hpp>
/*
* Object used for the snapshot API. This is opaque to the public library.
#ifndef LTTNG_SNAPSHOT_H
#define LTTNG_SNAPSHOT_H
-#include <limits.h>
#include <lttng/lttng-export.h>
+
+#include <limits.h>
#include <stdint.h>
#include <sys/types.h>
*/
/* Return snapshot ID. */
-LTTNG_EXPORT 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. */
-LTTNG_EXPORT 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. */
-LTTNG_EXPORT 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. */
-LTTNG_EXPORT 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. */
-LTTNG_EXPORT 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. */
LTTNG_EXPORT extern int lttng_snapshot_output_set_id(uint32_t id,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/* Set the maximum size. */
LTTNG_EXPORT extern int lttng_snapshot_output_set_size(uint64_t size,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/* Set the snapshot name. */
LTTNG_EXPORT extern int lttng_snapshot_output_set_name(const char *name,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/*
* Set the output destination to be a path on the local filesystem.
* Return 0 on success or else a negative LTTNG_ERR code.
*/
LTTNG_EXPORT extern int lttng_snapshot_output_set_local_path(const char *path,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/*
* Set the output destination to be the network from a combined control/data
* Return 0 on success or else a negative LTTNG_ERR code.
*/
LTTNG_EXPORT extern int lttng_snapshot_output_set_network_url(const char *url,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/*
* Set the output destination to be the network using separate URLs for control
* Return 0 on success or else a negative LTTNG_ERR code.
*/
LTTNG_EXPORT extern int lttng_snapshot_output_set_network_urls(
- const char *ctrl_url, const char *data_url,
- struct lttng_snapshot_output *output);
+ const char *ctrl_url, const char *data_url, struct lttng_snapshot_output *output);
/* Set the control URL. Local and remote URL are supported. */
LTTNG_EXPORT extern int lttng_snapshot_output_set_ctrl_url(const char *url,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/* Set the data URL. Local and remote URL are supported. */
LTTNG_EXPORT extern int lttng_snapshot_output_set_data_url(const char *url,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/*
* Add an output object to a session identified by name.
* Return 0 on success or else a negative LTTNG_ERR code.
*/
LTTNG_EXPORT extern int lttng_snapshot_add_output(const char *session_name,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/*
* Delete an output object to a session identified by name.
* Return 0 on success or else a negative LTTNG_ERR code.
*/
LTTNG_EXPORT extern int lttng_snapshot_del_output(const char *session_name,
- struct lttng_snapshot_output *output);
+ struct lttng_snapshot_output *output);
/*
* List all snapshot output(s) of a session identified by name. The output list
* is untouched.
*/
LTTNG_EXPORT extern int lttng_snapshot_list_output(const char *session_name,
- struct lttng_snapshot_output_list **list);
+ struct lttng_snapshot_output_list **list);
/*
* Return the next available snapshot output object in the given list. A list
* Return the next object on success or else NULL indicating the end of the
* list.
*/
-LTTNG_EXPORT extern struct lttng_snapshot_output *lttng_snapshot_output_list_get_next(
- struct lttng_snapshot_output_list *list);
+LTTNG_EXPORT extern struct lttng_snapshot_output *
+lttng_snapshot_output_list_get_next(struct lttng_snapshot_output_list *list);
/*
* Free an output list object.
*/
-LTTNG_EXPORT 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.
*/
-LTTNG_EXPORT extern int lttng_snapshot_record(const char *session_name,
- struct lttng_snapshot_output *output, int wait);
+LTTNG_EXPORT extern int
+lttng_snapshot_record(const char *session_name, struct lttng_snapshot_output *output, int wait);
#ifdef __cplusplus
}
* The tracker's ownership is transfered to the caller. Use
* lttng_process_attr_tracker_handle_destroy() to dispose of it.
*/
-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,
- struct lttng_process_attr_tracker_handle **out_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,
+ struct lttng_process_attr_tracker_handle **out_tracker_handle);
/*
* Destroy a process attribute tracker handle.
*/
-LTTNG_EXPORT extern void lttng_process_attr_tracker_handle_destroy(
- struct lttng_process_attr_tracker_handle *tracker_handle);
+LTTNG_EXPORT extern void
+lttng_process_attr_tracker_handle_destroy(struct lttng_process_attr_tracker_handle *tracker_handle);
/*
* Get the tracking policy of a process attribute tracker.
*/
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);
+ const struct lttng_process_attr_tracker_handle *tracker_handle,
+ enum lttng_tracking_policy *policy);
/*
* Set the tracking policy of a process attribute tracker.
*/
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);
+ const struct lttng_process_attr_tracker_handle *tracker_handle,
+ enum lttng_tracking_policy policy);
/*
* Add a numerical PID to the process ID process attribute tracker inclusion
*/
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,
- pid_t pid);
+ const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t pid);
/*
* Remove a numerical PID from the process ID process attribute tracker include
*/
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,
- pid_t pid);
+ const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t pid);
/*
* Add a numerical PID to the virtual process ID process attribute tracker
*/
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,
- pid_t vpid);
+ const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t vpid);
/*
* Remove a numerical PID from the virtual process ID process attribute tracker
*/
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,
- pid_t vpid);
+ const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t vpid);
/*
* Add a numerical UID to the user ID process attribute tracker inclusion set.
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid);
/*
* Remove a numerical UID from the user ID process attribute tracker include
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid);
/*
* Add a user name to the user ID process attribute tracker inclusion set.
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name);
/*
* Remove a user name from the user ID process attribute tracker include
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name);
/*
* Add a numerical UID to the virtual user ID process attribute tracker
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid);
/*
* Remove a numerical UID from the virtual user ID process attribute tracker
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid);
/*
* Add a user name to the virtual user ID process attribute tracker include
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker,
+ const char *virtual_user_name);
/*
* Remove a user name from the virtual user ID process attribute tracker
*/
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);
+ const struct lttng_process_attr_tracker_handle *user_id_tracker,
+ const char *virtual_user_name);
/*
* Add a numerical GID to the group ID process attribute tracker inclusion set.
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid);
/*
* Remove a numerical GID from the group ID process attribute tracker include
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid);
/*
* Add a group name to the group ID process attribute tracker inclusion set.
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name);
/*
* Remove a group name from the group ID process attribute tracker include
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name);
/*
* Add a numerical GID to the virtual group ID process attribute tracker
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid);
/*
* Remove a numerical GID from the virtual group ID process attribute tracker
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid);
/*
* Add a group name to the virtual group ID process attribute tracker include
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker,
+ const char *virtual_group_name);
/*
* Remove a group name from the virtual group ID process attribute tracker
*/
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);
+ const struct lttng_process_attr_tracker_handle *group_id_tracker,
+ const char *virtual_group_name);
/*
* Get the process attribute values that are part of a tracker's inclusion set.
*/
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);
+ struct lttng_process_attr_tracker_handle *tracker_handle,
+ const struct lttng_process_attr_values **values);
/*
* Get the count of values within a set of process attribute values.
* LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID if an invalid argument is provided.
*/
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);
+lttng_process_attr_values_get_count(const struct lttng_process_attr_values *values,
+ unsigned int *count);
/*
* Get the type of a process attribute value at a given index.
* LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID if an invalid argument is provided.
*/
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_get_type_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index);
/*
* Get a process ID process attribute value.
* is not a process ID.
*/
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,
- pid_t *pid);
+lttng_process_attr_values_get_pid_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index,
+ pid_t *pid);
/*
* Get a user ID process attribute value.
* is not a user ID.
*/
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,
- uid_t *uid);
+lttng_process_attr_values_get_uid_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index,
+ uid_t *uid);
/*
* Get a user name process attribute value.
* is not a user name.
*/
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,
- const char **user_name);
+lttng_process_attr_values_get_user_name_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index,
+ const char **user_name);
/*
* Get a group ID process attribute value.
* is not a group ID.
*/
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,
- gid_t *gid);
+lttng_process_attr_values_get_gid_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index,
+ gid_t *gid);
/*
* Get a group name process attribute value.
* is not a group name.
*/
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,
- const char **group_name);
+lttng_process_attr_values_get_group_name_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index,
+ const char **group_name);
/* The following entry points are deprecated. */
*
* Returns 0 on success, else a negative LTTng error code.
*/
-LTTNG_EXPORT extern int lttng_list_tracker_pids(struct lttng_handle *handle,
- int *enabled,
- int32_t **pids,
- size_t *nr_pids);
+LTTNG_EXPORT extern int
+lttng_list_tracker_pids(struct lttng_handle *handle, int *enabled, int32_t **pids, size_t *nr_pids);
/*
* Deprecated: see `lttng_process_attr_process_id_tracker_handle_add_pid`.
#include <common/dynamic-array.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+
#include <lttng/lttng.h>
+
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
};
ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *view,
- struct lttng_trigger **trigger);
+ struct lttng_trigger **trigger);
-int lttng_trigger_serialize(const struct lttng_trigger *trigger,
- struct lttng_payload *payload);
+int lttng_trigger_serialize(const struct lttng_trigger *trigger, struct lttng_payload *payload);
bool lttng_trigger_validate(const struct lttng_trigger *trigger);
-int lttng_trigger_assign_name(
- struct lttng_trigger *dst, const struct lttng_trigger *src);
+int lttng_trigger_assign_name(struct lttng_trigger *dst, const struct lttng_trigger *src);
-void lttng_trigger_set_tracer_token(
- struct lttng_trigger *trigger, uint64_t token);
+void lttng_trigger_set_tracer_token(struct lttng_trigger *trigger, uint64_t token);
uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger);
-int lttng_trigger_generate_name(struct lttng_trigger *trigger,
- uint64_t unique_id);
+int lttng_trigger_generate_name(struct lttng_trigger *trigger, uint64_t unique_id);
-bool lttng_trigger_is_equal(
- const struct lttng_trigger *a, const struct lttng_trigger *b);
+bool lttng_trigger_is_equal(const struct lttng_trigger *a, const struct lttng_trigger *b);
bool lttng_trigger_is_hidden(const struct lttng_trigger *trigger);
* Serialize a trigger to a mi_writer.
* Return LTTNG_OK in success, other enum lttng_error_code on error.
*/
-enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *trigger,
- struct mi_writer *writer,
- const struct mi_lttng_error_query_callbacks
- *error_query_callbacks);
+enum lttng_error_code
+lttng_trigger_mi_serialize(const struct lttng_trigger *trigger,
+ struct mi_writer *writer,
+ const struct mi_lttng_error_query_callbacks *error_query_callbacks);
/*
* Allocate a new set of triggers.
* The ownership of the trigger set element is NOT transfered.
* The returned object can NOT be freed via lttng_trigger_destroy.
*/
-struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(
- const struct lttng_triggers *triggers, unsigned int index);
+struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(const struct lttng_triggers *triggers,
+ unsigned int index);
/*
* Add a trigger to the triggers set.
* A reference to the added trigger is acquired on behalf of the trigger set
* on success.
*/
-int lttng_triggers_add(
- struct lttng_triggers *triggers, struct lttng_trigger *trigger);
+int lttng_triggers_add(struct lttng_triggers *triggers, struct lttng_trigger *trigger);
/*
* Remove all triggers marked as hidden from the provided trigger set.
* Serialize a trigger set to an lttng_payload object.
* Return LTTNG_OK on success, negative lttng error code on error.
*/
-int lttng_triggers_serialize(const struct lttng_triggers *triggers,
- struct lttng_payload *payload);
+int lttng_triggers_serialize(const struct lttng_triggers *triggers, struct lttng_payload *payload);
ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *view,
- struct lttng_triggers **triggers);
+ struct lttng_triggers **triggers);
/*
* Serialize a trigger set to a mi_writer.
* Return LTTNG_OK in success, other enum lttng_error_code on error.
*/
-enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *triggers,
- struct mi_writer *writer,
- const struct mi_lttng_error_query_callbacks
- *error_query_callbacks);
+enum lttng_error_code
+lttng_triggers_mi_serialize(const struct lttng_triggers *triggers,
+ struct mi_writer *writer,
+ const struct mi_lttng_error_query_callbacks *error_query_callbacks);
-const struct lttng_credentials *lttng_trigger_get_credentials(
- const struct lttng_trigger *trigger);
+const struct lttng_credentials *lttng_trigger_get_credentials(const struct lttng_trigger *trigger);
void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
- const struct lttng_credentials *creds);
+ const struct lttng_credentials *creds);
/*
* Return the type of any underlying domain restriction. If no particular
* requirement is present, returns LTTNG_DOMAIN_NONE.
*/
-enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
- const struct lttng_trigger *trigger);
+enum lttng_domain_type
+lttng_trigger_get_underlying_domain_type_restriction(const struct lttng_trigger *trigger);
/*
* Generate any bytecode related to the trigger.
* On success LTTNG_OK. On error, returns lttng_error code.
*/
-enum lttng_error_code lttng_trigger_generate_bytecode(
- struct lttng_trigger *trigger,
- const struct lttng_credentials *creds);
+enum lttng_error_code lttng_trigger_generate_bytecode(struct lttng_trigger *trigger,
+ const struct lttng_credentials *creds);
/*
* Note that the trigger object is not locked by "copy" as it is const and
void lttng_trigger_unlock(struct lttng_trigger *trigger);
-enum lttng_trigger_status lttng_trigger_add_error_results(
- const struct lttng_trigger *trigger,
- struct lttng_error_query_results *results);
+enum lttng_trigger_status
+lttng_trigger_add_error_results(const struct lttng_trigger *trigger,
+ struct lttng_error_query_results *results);
-enum lttng_trigger_status lttng_trigger_condition_add_error_results(
- const struct lttng_trigger *trigger,
- struct lttng_error_query_results *results);
+enum lttng_trigger_status
+lttng_trigger_condition_add_error_results(const struct lttng_trigger *trigger,
+ struct lttng_error_query_results *results);
-enum lttng_trigger_status lttng_trigger_add_action_error_query_results(
- struct lttng_trigger *trigger,
- struct lttng_error_query_results *results);
+enum lttng_trigger_status
+lttng_trigger_add_action_error_query_results(struct lttng_trigger *trigger,
+ struct lttng_error_query_results *results);
/*
* Set the trigger name.
* Return LTTNG_TRIGGER_STATUS_OK on success, LTTNG_TRIGGER_STATUS_INVALID
* if invalid parameters are passed.
*/
-enum lttng_trigger_status lttng_trigger_set_name(
- struct lttng_trigger *trigger, const char *name);
+enum lttng_trigger_status lttng_trigger_set_name(struct lttng_trigger *trigger, const char *name);
#endif /* LTTNG_TRIGGER_INTERNAL_H */
#ifndef LTTNG_TRIGGER_H
#define LTTNG_TRIGGER_H
-#include <sys/types.h>
#include <lttng/constant.h>
-#include <inttypes.h>
#include <lttng/lttng-error.h>
#include <lttng/lttng-export.h>
+#include <inttypes.h>
+#include <sys/types.h>
+
struct lttng_action;
struct lttng_condition;
struct lttng_trigger;
* Trigger objects must be destroyed using the lttng_trigger_destroy()
* function.
*/
-LTTNG_EXPORT extern struct lttng_trigger *lttng_trigger_create(
- struct lttng_condition *condition, struct lttng_action *action);
+LTTNG_EXPORT extern struct lttng_trigger *lttng_trigger_create(struct lttng_condition *condition,
+ struct lttng_action *action);
/*
* Set the user identity (uid) of a trigger.
* LTTNG_TRIGGER_STATUS_EPERM if not authorized,
* LTTNG_TRIGGER_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_set_owner_uid(
- struct lttng_trigger *trigger, uid_t uid);
+LTTNG_EXPORT extern enum lttng_trigger_status
+lttng_trigger_set_owner_uid(struct lttng_trigger *trigger, uid_t uid);
/*
* Get the user identity (uid) of a trigger.
* LTTNG_TRIGGER_STATUS_UNSET if unset,
* LTTNG_TRIGGER_STATUS_INVALID if invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_owner_uid(
- const struct lttng_trigger *trigger, uid_t *uid);
+LTTNG_EXPORT extern enum lttng_trigger_status
+lttng_trigger_get_owner_uid(const struct lttng_trigger *trigger, uid_t *uid);
/*
* Get the condition of a trigger.
*
* Returns a condition on success, NULL on error.
*/
-LTTNG_EXPORT extern struct lttng_condition *lttng_trigger_get_condition(
- struct lttng_trigger *trigger);
+LTTNG_EXPORT extern struct lttng_condition *
+lttng_trigger_get_condition(struct lttng_trigger *trigger);
-LTTNG_EXPORT extern const struct lttng_condition *lttng_trigger_get_const_condition(
- const struct lttng_trigger *trigger);
+LTTNG_EXPORT extern const struct lttng_condition *
+lttng_trigger_get_const_condition(const struct lttng_trigger *trigger);
/*
* Get the action of a trigger.
*
* Returns an action on success, NULL on error.
*/
-LTTNG_EXPORT extern struct lttng_action *lttng_trigger_get_action(
- struct lttng_trigger *trigger);
+LTTNG_EXPORT extern struct lttng_action *lttng_trigger_get_action(struct lttng_trigger *trigger);
-LTTNG_EXPORT extern const struct lttng_action *lttng_trigger_get_const_action(
- const struct lttng_trigger *trigger);
+LTTNG_EXPORT extern const struct lttng_action *
+lttng_trigger_get_const_action(const struct lttng_trigger *trigger);
/*
* Get the name of a trigger.
* success, LTTNG_TRIGGER_STATUS_INVALID if an invalid parameter is passed,
* or LTTNG_TRIGGER_STATUS_UNSET if the trigger is unnamed.
*/
-LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_name(
- const struct lttng_trigger *trigger, const char **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.
*
* Returns an LTTng status code.
*/
-LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_name(
- struct lttng_trigger *trigger,
- const char *name);
+LTTNG_EXPORT extern enum lttng_error_code
+lttng_register_trigger_with_name(struct lttng_trigger *trigger, const char *name);
/*
* Register a trigger to the session daemon, generating a unique name for its
*
* Returns an LTTng status code.
*/
-LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_automatic_name(
- struct lttng_trigger *trigger);
+LTTNG_EXPORT extern enum lttng_error_code
+lttng_register_trigger_with_automatic_name(struct lttng_trigger *trigger);
/*
* Unregister a trigger from the session daemon.
*
* Returns LTTNG_OK on success, else a suitable LTTng error code.
*/
-LTTNG_EXPORT extern enum lttng_error_code lttng_list_triggers(
- struct lttng_triggers **triggers);
+LTTNG_EXPORT extern enum lttng_error_code lttng_list_triggers(struct lttng_triggers **triggers);
/*
* Get a trigger from the set at a given index.
*
* Returns a trigger, or NULL on error.
*/
-LTTNG_EXPORT extern const struct lttng_trigger *lttng_triggers_get_at_index(
- const struct lttng_triggers *triggers, unsigned int index);
+LTTNG_EXPORT extern const struct lttng_trigger *
+lttng_triggers_get_at_index(const struct lttng_triggers *triggers, unsigned int index);
/*
* Get the number of triggers in a trigger set.
* Return LTTNG_TRIGGER_STATUS_OK on success,
* LTTNG_TRIGGER_STATUS_INVALID when invalid parameters are passed.
*/
-LTTNG_EXPORT extern enum lttng_trigger_status lttng_triggers_get_count(
- const struct lttng_triggers *triggers, unsigned int *count);
+LTTNG_EXPORT extern enum lttng_trigger_status
+lttng_triggers_get_count(const struct lttng_triggers *triggers, unsigned int *count);
/*
* Destroy a trigger set.
struct fd_handle *binary_fd_handle;
};
-int lttng_userspace_probe_location_serialize(
- const struct lttng_userspace_probe_location *location,
- struct lttng_payload *payload);
+int lttng_userspace_probe_location_serialize(const struct lttng_userspace_probe_location *location,
+ struct lttng_payload *payload);
int lttng_userspace_probe_location_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_userspace_probe_location **probe_location);
+ struct lttng_payload_view *view, struct lttng_userspace_probe_location **probe_location);
/*
* Returns a version of the location that is serialized to a contiguous region
* of memory. Pass NULL to buffer to only get the storage requirement of the
* flattened userspace probe location.
*/
-int lttng_userspace_probe_location_flatten(
- const struct lttng_userspace_probe_location *location,
- struct lttng_dynamic_buffer *buffer);
+int lttng_userspace_probe_location_flatten(const struct lttng_userspace_probe_location *location,
+ struct lttng_dynamic_buffer *buffer);
-struct lttng_userspace_probe_location *lttng_userspace_probe_location_copy(
- const struct lttng_userspace_probe_location *location);
+struct lttng_userspace_probe_location *
+lttng_userspace_probe_location_copy(const struct lttng_userspace_probe_location *location);
bool lttng_userspace_probe_location_lookup_method_is_equal(
- const struct lttng_userspace_probe_location_lookup_method *a,
- const struct lttng_userspace_probe_location_lookup_method *b);
+ const struct lttng_userspace_probe_location_lookup_method *a,
+ const struct lttng_userspace_probe_location_lookup_method *b);
-bool lttng_userspace_probe_location_is_equal(
- const struct lttng_userspace_probe_location *a,
- const struct lttng_userspace_probe_location *b);
+bool lttng_userspace_probe_location_is_equal(const struct lttng_userspace_probe_location *a,
+ const struct lttng_userspace_probe_location *b);
-unsigned long lttng_userspace_probe_location_hash(
- const struct lttng_userspace_probe_location *location);
+unsigned long
+lttng_userspace_probe_location_hash(const struct lttng_userspace_probe_location *location);
-enum lttng_error_code lttng_userspace_probe_location_mi_serialize(
- const struct lttng_userspace_probe_location *location,
- struct mi_writer *writer);
+enum lttng_error_code
+lttng_userspace_probe_location_mi_serialize(const struct lttng_userspace_probe_location *location,
+ struct mi_writer *writer);
#endif /* LTTNG_USERSPACE_PROBE_INTERNAL_H */
struct lttng_userspace_probe_location_lookup_method;
enum lttng_userspace_probe_location_lookup_method_type {
- LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_UNKNOWN = -1,
- LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT = 0,
- LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF = 1,
- LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT = 2,
+ LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_UNKNOWN = -1,
+ LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT = 0,
+ LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF = 1,
+ LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT = 2,
};
/*
*/
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);
+ const struct lttng_userspace_probe_location_lookup_method *lookup_method);
/*
* Destroy a lookup method.
*/
LTTNG_EXPORT extern void lttng_userspace_probe_location_lookup_method_destroy(
- struct lttng_userspace_probe_location_lookup_method *lookup_method);
+ struct lttng_userspace_probe_location_lookup_method *lookup_method);
/*
* Create a tracepoint ELF function lookup method struct.
LTTNG_EXPORT extern struct lttng_userspace_probe_location_lookup_method *
lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create(void);
-
/*
* Contains all the information needed to compute the instrumentation point in
* the binary. It is used in conjonction with a lookup method.
struct lttng_userspace_probe_location;
enum lttng_userspace_probe_location_status {
- LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK = 0,
+ LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK = 0,
/* Invalid parameters provided. */
- LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID = -1,
+ LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID = -1,
};
enum lttng_userspace_probe_location_type {
- LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN = -1,
+ LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN = -1,
/* Function. */
- LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION = 0,
+ LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION = 0,
/* SDT probe's callsites. */
- LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT = 1,
+ LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT = 1,
};
/*
* Get the type of the userspace probe location.
*/
LTTNG_EXPORT extern enum lttng_userspace_probe_location_type
-lttng_userspace_probe_location_get_type(
- const struct lttng_userspace_probe_location *location);
+lttng_userspace_probe_location_get_type(const struct lttng_userspace_probe_location *location);
/*
* Destroy the userspace probe location.
*/
-LTTNG_EXPORT extern void lttng_userspace_probe_location_destroy(
- struct lttng_userspace_probe_location *location);
-
+LTTNG_EXPORT extern void
+lttng_userspace_probe_location_destroy(struct lttng_userspace_probe_location *location);
enum lttng_userspace_probe_location_function_instrumentation_type {
LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_UNKNOWN = -1,
* 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);
+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.
*/
LTTNG_EXPORT extern const char *lttng_userspace_probe_location_function_get_binary_path(
- const struct lttng_userspace_probe_location *location);
+ const struct lttng_userspace_probe_location *location);
/*
* Get the target function type of the probe location of the function type.
*/
LTTNG_EXPORT extern const char *lttng_userspace_probe_location_function_get_function_name(
- const struct lttng_userspace_probe_location *location);
+ 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`.
*/
LTTNG_EXPORT extern int lttng_userspace_probe_location_function_get_binary_fd(
- const struct lttng_userspace_probe_location *location);
+ const struct lttng_userspace_probe_location *location);
/*
* Get the instrumentation type of the function probe location.
*/
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);
+ const struct lttng_userspace_probe_location *location);
/*
* Get the instrumentation type of the function probe location.
*/
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);
+ const struct lttng_userspace_probe_location *location,
+ enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type);
/*
* Get the lookup method of the given userspace probe location.
*/
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);
+ const struct lttng_userspace_probe_location *location);
/*
* Create a probe location of the tracepoint type.
* 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);
+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.
*/
LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_binary_path(
- const struct lttng_userspace_probe_location *location);
+ const struct lttng_userspace_probe_location *location);
/*
* Get the target probe name of the probe location of the tracepoint type.
*/
LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_probe_name(
- const struct lttng_userspace_probe_location *location);
+ const struct lttng_userspace_probe_location *location);
/*
* Get the target probe provider name of the probe location of the tracepoint
* type.
*/
LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_provider_name(
- const struct lttng_userspace_probe_location *location);
+ 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`.
*/
LTTNG_EXPORT extern int lttng_userspace_probe_location_tracepoint_get_binary_fd(
- const struct lttng_userspace_probe_location *location);
+ const struct lttng_userspace_probe_location *location);
#ifdef __cplusplus
}
#include <lttng/health-internal.hpp>
enum health_type_consumerd {
- HEALTH_CONSUMERD_TYPE_CHANNEL = 0,
- HEALTH_CONSUMERD_TYPE_METADATA = 1,
- HEALTH_CONSUMERD_TYPE_DATA = 2,
- HEALTH_CONSUMERD_TYPE_SESSIOND = 3,
- HEALTH_CONSUMERD_TYPE_METADATA_TIMER = 4,
+ HEALTH_CONSUMERD_TYPE_CHANNEL = 0,
+ HEALTH_CONSUMERD_TYPE_METADATA = 1,
+ HEALTH_CONSUMERD_TYPE_DATA = 2,
+ HEALTH_CONSUMERD_TYPE_SESSIOND = 3,
+ HEALTH_CONSUMERD_TYPE_METADATA_TIMER = 4,
NR_HEALTH_CONSUMERD_TYPES,
};
#include <common/consumer/consumer.hpp>
-#define NR_LTTNG_CONSUMER_READY 1
+#define NR_LTTNG_CONSUMER_READY 1
extern int lttng_consumer_ready;
extern const char *tracing_group_name;
* have a C linkage name makes it easier, as it avoids having to look up a
* mangled name.
*/
-extern "C" LTTNG_EXPORT
-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 <time.h>
char *backward_compat_group_by_session(const char *path,
- const char *local_session_name,
- time_t session_creation_time);
+ const char *local_session_name,
+ time_t session_creation_time);
#endif /* BACKWARD_COMPATIBILITY_GROUP_BY_H */
*/
#include "lttng-relayd.hpp"
+
#include <common/buffer-view.hpp>
int cmd_recv_stream_2_1(const struct lttng_buffer_view *payload,
- char **path_name, char **channel_name);
+ char **path_name,
+ char **channel_name);
#endif /* RELAYD_CMD_2_1_H */
#define RELAYD_CMD_2_11_H
#include "lttng-relayd.hpp"
+
#include <common/buffer-view.hpp>
#include <common/uuid.hpp>
int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
- char *session_name, char *hostname, char *base_path,
- uint32_t *live_timer, bool *snapshot,
- uint64_t *id_sessiond, lttng_uuid& sessiond_uuid,
- bool *has_current_chunk, uint64_t *current_chunk_id,
- time_t *creation_time,
- bool *session_name_contains_creation_time);
+ char *session_name,
+ char *hostname,
+ char *base_path,
+ uint32_t *live_timer,
+ bool *snapshot,
+ uint64_t *id_sessiond,
+ lttng_uuid& sessiond_uuid,
+ bool *has_current_chunk,
+ uint64_t *current_chunk_id,
+ time_t *creation_time,
+ bool *session_name_contains_creation_time);
int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
- char **ret_path_name, char **ret_channel_name,
- uint64_t *tracefile_size, uint64_t *tracefile_count,
- uint64_t *trace_archive_id);
+ char **ret_path_name,
+ char **ret_channel_name,
+ uint64_t *tracefile_size,
+ uint64_t *tracefile_count,
+ uint64_t *trace_archive_id);
#endif /* RELAYD_CMD_2_11_H */
*/
#include "lttng-relayd.hpp"
+
#include <common/buffer-view.hpp>
int cmd_recv_stream_2_2(const struct lttng_buffer_view *payload,
- char **path_name, char **channel_name,
- uint64_t *tracefile_size, uint64_t *tracefile_count);
+ char **path_name,
+ char **channel_name,
+ uint64_t *tracefile_size,
+ uint64_t *tracefile_count);
#endif /* RELAYD_CMD_2_2_H */
*/
#include "lttng-relayd.hpp"
+
#include <common/buffer-view.hpp>
int cmd_create_session_2_4(const struct lttng_buffer_view *payload,
- char *session_name, char *hostname,
- uint32_t *live_timer, bool *snapshot);
+ char *session_name,
+ char *hostname,
+ uint32_t *live_timer,
+ bool *snapshot);
#endif /* RELAYD_CMD_2_4_H */
*/
#include "cmd-2-1.hpp"
+#include "cmd-2-11.hpp"
#include "cmd-2-2.hpp"
#include "cmd-2-4.hpp"
-#include "cmd-2-11.hpp"
#endif /* RELAYD_CMD_H */
*
*/
-#include <limits.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <urcu.h>
-#include <urcu/wfcqueue.h>
-#include <urcu/list.h>
+#include "session.hpp"
+#include <common/dynamic-buffer.hpp>
#include <common/hashtable/hashtable.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
#include <common/sessiond-comm/relayd.hpp>
-#include <common/dynamic-buffer.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
-#include "session.hpp"
+#include <inttypes.h>
+#include <limits.h>
+#include <pthread.h>
+#include <urcu.h>
+#include <urcu/list.h>
+#include <urcu/wfcqueue.h>
enum connection_type {
- RELAY_CONNECTION_UNKNOWN = 0,
- RELAY_DATA = 1,
- RELAY_CONTROL = 2,
- RELAY_VIEWER_COMMAND = 3,
- RELAY_VIEWER_NOTIFICATION = 4,
+ RELAY_CONNECTION_UNKNOWN = 0,
+ RELAY_DATA = 1,
+ RELAY_CONTROL = 2,
+ RELAY_VIEWER_COMMAND = 3,
+ RELAY_VIEWER_NOTIFICATION = 4,
};
enum data_connection_state {
*/
struct lttng_ht_node_ulong sock_n;
bool in_socket_ht;
- struct lttng_ht *socket_ht; /* HACK: Contained within this hash table. */
- struct rcu_head rcu_node; /* For call_rcu teardown. */
+ struct lttng_ht *socket_ht; /* HACK: Contained within this hash table. */
+ struct rcu_head rcu_node; /* For call_rcu teardown. */
union {
struct {
} protocol;
};
-struct relay_connection *connection_create(struct lttcomm_sock *sock,
- enum connection_type type);
-struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connections_ht,
- int sock);
+struct relay_connection *connection_create(struct lttcomm_sock *sock, enum connection_type type);
+struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connections_ht, int sock);
int connection_reset_protocol_state(struct relay_connection *connection);
bool connection_get(struct relay_connection *connection);
void connection_put(struct relay_connection *connection);
-void connection_ht_add(struct lttng_ht *relay_connections_ht,
- struct relay_connection *conn);
-int connection_set_session(struct relay_connection *conn,
- struct relay_session *session);
+void connection_ht_add(struct lttng_ht *relay_connections_ht, struct relay_connection *conn);
+int connection_set_session(struct relay_connection *conn, struct relay_session *session);
#endif /* _CONNECTION_H */
*
*/
-#include <inttypes.h>
-#include <urcu/ref.h>
-
-#include <common/hashtable/hashtable.hpp>
-
#include "session.hpp"
#include "stream.hpp"
#include "viewer-stream.hpp"
+#include <common/hashtable/hashtable.hpp>
+
+#include <inttypes.h>
+#include <urcu/ref.h>
+
struct ctf_trace {
- struct urcu_ref ref; /* Every stream has a ref on the trace. */
- struct relay_session *session; /* Back ref to trace session */
+ struct urcu_ref ref; /* Every stream has a ref on the trace. */
+ struct relay_session *session; /* Back ref to trace session */
/* Trace sub-folder relative to the session output path. */
char *path;
*/
pthread_mutex_t lock;
uint64_t id;
- struct relay_viewer_stream *viewer_metadata_stream; /* RCU protected */
+ struct relay_viewer_stream *viewer_metadata_stream; /* RCU protected */
/*
* Relay streams associated with this ctf trace.
* stream path name.
*/
struct lttng_ht_node_str node;
- struct rcu_head rcu_node; /* For call_rcu teardown. */
+ struct rcu_head rcu_node; /* For call_rcu teardown. */
/*
* True if the metadata stream of this trace was sent the viewer in the
};
struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session,
- const char *subpath);
+ const char *subpath);
bool ctf_trace_get(struct ctf_trace *trace);
void ctf_trace_put(struct ctf_trace *trace);
*
*/
-#include <limits.h>
#include <lttng/health-internal.hpp>
-#define LTTNG_RELAYD_HEALTH_ENV "LTTNG_RELAYD_HEALTH"
+#include <limits.h>
+
+#define LTTNG_RELAYD_HEALTH_ENV "LTTNG_RELAYD_HEALTH"
enum health_type_relayd {
- HEALTH_RELAYD_TYPE_DISPATCHER = 0,
- HEALTH_RELAYD_TYPE_WORKER = 1,
- HEALTH_RELAYD_TYPE_LISTENER = 2,
- HEALTH_RELAYD_TYPE_LIVE_DISPATCHER = 3,
- HEALTH_RELAYD_TYPE_LIVE_WORKER = 4,
- HEALTH_RELAYD_TYPE_LIVE_LISTENER = 5,
+ HEALTH_RELAYD_TYPE_DISPATCHER = 0,
+ HEALTH_RELAYD_TYPE_WORKER = 1,
+ HEALTH_RELAYD_TYPE_LISTENER = 2,
+ HEALTH_RELAYD_TYPE_LIVE_DISPATCHER = 3,
+ HEALTH_RELAYD_TYPE_LIVE_WORKER = 4,
+ HEALTH_RELAYD_TYPE_LIVE_LISTENER = 5,
NR_HEALTH_RELAYD_TYPES,
};
*
*/
-#include <inttypes.h>
-#include <pthread.h>
-
#include <common/hashtable/hashtable.hpp>
#include <common/index/index.hpp>
+#include <inttypes.h>
+#include <pthread.h>
+
struct relay_stream;
struct relay_connection;
struct lttcomm_relayd_index;
/*
* index lock nests inside stream lock.
*/
- struct urcu_ref ref; /* Reference from getters. */
- struct relay_stream *stream; /* Back ref to stream */
+ struct urcu_ref ref; /* Reference from getters. */
+ struct relay_stream *stream; /* Back ref to stream */
pthread_mutex_t lock;
/*
* index across the stream.
*/
struct lttng_ht_node_u64 index_n;
- struct rcu_head rcu_node; /* For call_rcu teardown. */
+ struct rcu_head rcu_node; /* For call_rcu teardown. */
};
struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
- uint64_t net_seq_num);
+ uint64_t net_seq_num);
void relay_index_put(struct relay_index *index);
int relay_index_set_file(struct relay_index *index,
- struct lttng_index_file *index_file,
- uint64_t data_offset);
-int relay_index_set_data(struct relay_index *index,
- const struct ctf_packet_index *data);
+ struct lttng_index_file *index_file,
+ uint64_t data_offset);
+int relay_index_set_data(struct relay_index *index, const struct ctf_packet_index *data);
int relay_index_try_flush(struct relay_index *index);
void relay_index_close_all(struct relay_stream *stream);
uint64_t relay_index_find_last(struct relay_stream *stream);
int relay_index_switch_all_files(struct relay_stream *stream);
int relay_index_set_control_data(struct relay_index *index,
- const struct lttcomm_relayd_index *data,
- unsigned int minor_version);
+ const struct lttcomm_relayd_index *data,
+ unsigned int minor_version);
#endif /* _RELAY_INDEX_H */
*
*/
-#include <common/uri.hpp>
-
#include "lttng-relayd.hpp"
+#include <common/uri.hpp>
+
int relayd_live_create(struct lttng_uri *live_uri);
int relayd_live_stop(void);
int relayd_live_join(void);
*
*/
+#include <common/compat/poll.hpp>
+#include <common/fd-tracker/fd-tracker.hpp>
+#include <common/hashtable/hashtable.hpp>
+
#include <limits.h>
#include <urcu.h>
#include <urcu/wfcqueue.h>
-#include <common/compat/poll.hpp>
-#include <common/hashtable/hashtable.hpp>
-#include <common/fd-tracker/fd-tracker.hpp>
-
struct sessiond_trace_chunk_registry;
/*
extern char *opt_output_path;
extern const char *tracing_group_name;
-extern const char * const config_section_name;
+extern const char *const config_section_name;
extern enum relay_group_output_by opt_group_output_by;
extern struct fd_tracker *the_fd_tracker;
void relayd_close_thread_quit_pipe(void);
bool relayd_is_thread_quit_pipe(const int fd);
-int create_named_thread_poll_set(struct lttng_poll_event *events,
- int size, const char *name);
+int create_named_thread_poll_set(struct lttng_poll_event *events, int size, const char *name);
#endif /* LTTNG_RELAYD_H */
*
*/
-#include <limits.h>
#include <common/macros.hpp>
-#define LTTNG_VIEWER_PATH_MAX 4096
-#define LTTNG_VIEWER_NAME_MAX 255
-#define LTTNG_VIEWER_HOST_NAME_MAX 64
+#include <limits.h>
+
+#define LTTNG_VIEWER_PATH_MAX 4096
+#define LTTNG_VIEWER_NAME_MAX 255
+#define LTTNG_VIEWER_HOST_NAME_MAX 64
/* Flags in reply to get_next_index and get_packet. */
enum {
/* New metadata is required to read this packet. */
- LTTNG_VIEWER_FLAG_NEW_METADATA = (1 << 0),
+ LTTNG_VIEWER_FLAG_NEW_METADATA = (1 << 0),
/* New stream got added to the trace. */
- LTTNG_VIEWER_FLAG_NEW_STREAM = (1 << 1),
+ LTTNG_VIEWER_FLAG_NEW_STREAM = (1 << 1),
};
enum lttng_viewer_command {
- LTTNG_VIEWER_CONNECT = 1,
- LTTNG_VIEWER_LIST_SESSIONS = 2,
- LTTNG_VIEWER_ATTACH_SESSION = 3,
- LTTNG_VIEWER_GET_NEXT_INDEX = 4,
- LTTNG_VIEWER_GET_PACKET = 5,
- LTTNG_VIEWER_GET_METADATA = 6,
- LTTNG_VIEWER_GET_NEW_STREAMS = 7,
- LTTNG_VIEWER_CREATE_SESSION = 8,
- LTTNG_VIEWER_DETACH_SESSION = 9,
+ LTTNG_VIEWER_CONNECT = 1,
+ LTTNG_VIEWER_LIST_SESSIONS = 2,
+ LTTNG_VIEWER_ATTACH_SESSION = 3,
+ LTTNG_VIEWER_GET_NEXT_INDEX = 4,
+ LTTNG_VIEWER_GET_PACKET = 5,
+ LTTNG_VIEWER_GET_METADATA = 6,
+ LTTNG_VIEWER_GET_NEW_STREAMS = 7,
+ LTTNG_VIEWER_CREATE_SESSION = 8,
+ LTTNG_VIEWER_DETACH_SESSION = 9,
};
enum lttng_viewer_attach_return_code {
- LTTNG_VIEWER_ATTACH_OK = 1, /* The attach command succeeded. */
- LTTNG_VIEWER_ATTACH_ALREADY = 2, /* A viewer is already attached. */
- LTTNG_VIEWER_ATTACH_UNK = 3, /* The session ID is unknown. */
- LTTNG_VIEWER_ATTACH_NOT_LIVE = 4, /* The session is not live. */
- LTTNG_VIEWER_ATTACH_SEEK_ERR = 5, /* Seek error. */
- LTTNG_VIEWER_ATTACH_NO_SESSION = 6, /* No viewer session created. */
+ LTTNG_VIEWER_ATTACH_OK = 1, /* The attach command succeeded. */
+ LTTNG_VIEWER_ATTACH_ALREADY = 2, /* A viewer is already attached. */
+ LTTNG_VIEWER_ATTACH_UNK = 3, /* The session ID is unknown. */
+ LTTNG_VIEWER_ATTACH_NOT_LIVE = 4, /* The session is not live. */
+ LTTNG_VIEWER_ATTACH_SEEK_ERR = 5, /* Seek error. */
+ LTTNG_VIEWER_ATTACH_NO_SESSION = 6, /* No viewer session created. */
};
enum lttng_viewer_next_index_return_code {
- LTTNG_VIEWER_INDEX_OK = 1, /* Index is available. */
- LTTNG_VIEWER_INDEX_RETRY = 2, /* Index not yet available. */
- LTTNG_VIEWER_INDEX_HUP = 3, /* Index closed (trace destroyed). */
- LTTNG_VIEWER_INDEX_ERR = 4, /* Unknow error. */
- LTTNG_VIEWER_INDEX_INACTIVE = 5, /* Inactive stream beacon. */
- LTTNG_VIEWER_INDEX_EOF = 6, /* End of index file. */
+ LTTNG_VIEWER_INDEX_OK = 1, /* Index is available. */
+ LTTNG_VIEWER_INDEX_RETRY = 2, /* Index not yet available. */
+ LTTNG_VIEWER_INDEX_HUP = 3, /* Index closed (trace destroyed). */
+ LTTNG_VIEWER_INDEX_ERR = 4, /* Unknow error. */
+ LTTNG_VIEWER_INDEX_INACTIVE = 5, /* Inactive stream beacon. */
+ LTTNG_VIEWER_INDEX_EOF = 6, /* End of index file. */
};
enum lttng_viewer_get_packet_return_code {
- LTTNG_VIEWER_GET_PACKET_OK = 1,
- LTTNG_VIEWER_GET_PACKET_RETRY = 2,
- LTTNG_VIEWER_GET_PACKET_ERR = 3,
- LTTNG_VIEWER_GET_PACKET_EOF = 4,
+ LTTNG_VIEWER_GET_PACKET_OK = 1,
+ LTTNG_VIEWER_GET_PACKET_RETRY = 2,
+ LTTNG_VIEWER_GET_PACKET_ERR = 3,
+ LTTNG_VIEWER_GET_PACKET_EOF = 4,
};
enum lttng_viewer_get_metadata_return_code {
- LTTNG_VIEWER_METADATA_OK = 1,
- LTTNG_VIEWER_NO_NEW_METADATA = 2,
- LTTNG_VIEWER_METADATA_ERR = 3,
+ LTTNG_VIEWER_METADATA_OK = 1,
+ LTTNG_VIEWER_NO_NEW_METADATA = 2,
+ LTTNG_VIEWER_METADATA_ERR = 3,
};
enum lttng_viewer_connection_type {
- LTTNG_VIEWER_CLIENT_COMMAND = 1,
- LTTNG_VIEWER_CLIENT_NOTIFICATION = 2,
+ LTTNG_VIEWER_CLIENT_COMMAND = 1,
+ LTTNG_VIEWER_CLIENT_NOTIFICATION = 2,
};
enum lttng_viewer_seek {
/* Receive the trace packets from the beginning. */
- LTTNG_VIEWER_SEEK_BEGINNING = 1,
+ LTTNG_VIEWER_SEEK_BEGINNING = 1,
/* Receive the trace packets from now. */
- LTTNG_VIEWER_SEEK_LAST = 2,
+ LTTNG_VIEWER_SEEK_LAST = 2,
};
enum lttng_viewer_new_streams_return_code {
- LTTNG_VIEWER_NEW_STREAMS_OK = 1, /* If new streams are being sent. */
- LTTNG_VIEWER_NEW_STREAMS_NO_NEW = 2, /* If no new streams are available. */
- LTTNG_VIEWER_NEW_STREAMS_ERR = 3, /* Error. */
- LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */
+ LTTNG_VIEWER_NEW_STREAMS_OK = 1, /* If new streams are being sent. */
+ LTTNG_VIEWER_NEW_STREAMS_NO_NEW = 2, /* If no new streams are available. */
+ LTTNG_VIEWER_NEW_STREAMS_ERR = 3, /* Error. */
+ LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */
};
enum lttng_viewer_create_session_return_code {
- LTTNG_VIEWER_CREATE_SESSION_OK = 1,
- LTTNG_VIEWER_CREATE_SESSION_ERR = 2,
+ LTTNG_VIEWER_CREATE_SESSION_OK = 1,
+ LTTNG_VIEWER_CREATE_SESSION_ERR = 2,
};
enum lttng_viewer_detach_session_return_code {
- LTTNG_VIEWER_DETACH_SESSION_OK = 1,
- LTTNG_VIEWER_DETACH_SESSION_UNK = 2,
- LTTNG_VIEWER_DETACH_SESSION_ERR = 3,
+ LTTNG_VIEWER_DETACH_SESSION_OK = 1,
+ LTTNG_VIEWER_DETACH_SESSION_UNK = 2,
+ LTTNG_VIEWER_DETACH_SESSION_ERR = 3,
};
struct lttng_viewer_session {
} LTTNG_PACKED;
struct lttng_viewer_cmd {
- uint64_t data_size; /* data size following this header */
- uint32_t cmd; /* enum lttcomm_relayd_command */
- uint32_t cmd_version; /* command version */
+ uint64_t data_size; /* data size following this header */
+ uint32_t cmd; /* enum lttcomm_relayd_command */
+ uint32_t cmd_version; /* command version */
} LTTNG_PACKED;
/*
uint64_t viewer_session_id;
uint32_t major;
uint32_t minor;
- uint32_t type; /* enum lttng_viewer_connection_type */
+ uint32_t type; /* enum lttng_viewer_connection_type */
} LTTNG_PACKED;
/*
*/
struct lttng_viewer_list_sessions {
uint32_t sessions_count;
- char session_list[]; /* struct lttng_viewer_session */
+ char session_list[]; /* struct lttng_viewer_session */
} LTTNG_PACKED;
/*
*/
struct lttng_viewer_attach_session_request {
uint64_t session_id;
- uint64_t offset; /* unused for now */
- uint32_t seek; /* enum lttng_viewer_seek */
+ uint64_t offset; /* unused for now */
+ uint32_t seek; /* enum lttng_viewer_seek */
} LTTNG_PACKED;
struct lttng_viewer_attach_session_response {
*/
struct lttng_viewer_get_next_index {
uint64_t stream_id;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
struct lttng_viewer_index {
uint64_t offset;
uint64_t timestamp_end;
uint64_t events_discarded;
uint64_t stream_id;
- uint32_t status; /* enum lttng_viewer_next_index_return_code */
- uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
-} __attribute__ ((__packed__));
+ uint32_t status; /* enum lttng_viewer_next_index_return_code */
+ uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
+} __attribute__((__packed__));
/*
* LTTNG_VIEWER_GET_PACKET payload.
} LTTNG_PACKED;
struct lttng_viewer_trace_packet {
- uint32_t status; /* enum lttng_viewer_get_packet_return_code */
+ uint32_t status; /* enum lttng_viewer_get_packet_return_code */
uint32_t len;
- uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
+ uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
char data[];
} LTTNG_PACKED;
struct lttng_viewer_metadata_packet {
uint64_t len;
- uint32_t status; /* enum lttng_viewer_get_metadata_return_code */
+ uint32_t status; /* enum lttng_viewer_get_metadata_return_code */
char data[];
} LTTNG_PACKED;
* the data will be read at some point in time
* or wait to the end of the world :)
*/
- ret = lttng_write(relay_conn_pipe[1], &new_conn, sizeof(new_conn)); /* NOLINT
- sizeof
- used
- on a
- pointer.
- */
+ ret = lttng_write(
+ relay_conn_pipe[1], &new_conn, sizeof(new_conn)); /* NOLINT
+ sizeof
+ used
+ on a
+ pointer.
+ */
if (ret < 0) {
PERROR("write connection pipe");
connection_put(new_conn);
*
*/
-#include <limits.h>
+#include <common/hashtable/hashtable.hpp>
+#include <common/optional.hpp>
+#include <common/trace-chunk.hpp>
+#include <common/uuid.hpp>
+
+#include <lttng/constant.h>
+
#include <inttypes.h>
+#include <limits.h>
#include <pthread.h>
#include <urcu/list.h>
#include <urcu/ref.h>
-#include <lttng/constant.h>
-#include <common/hashtable/hashtable.hpp>
-#include <common/uuid.hpp>
-#include <common/trace-chunk.hpp>
-#include <common/optional.hpp>
-
/*
* Represents a session for the relay point of view
*/
* Traversals are protected by RCU.
* recv_list_lock also protects stream_count.
*/
- struct cds_list_head recv_list; /* RCU list. */
+ struct cds_list_head recv_list; /* RCU list. */
uint32_t stream_count;
pthread_mutex_t recv_list_lock;
*/
bool ongoing_rotation;
struct lttng_directory_handle *output_directory;
- struct rcu_head rcu_node; /* For call_rcu teardown. */
+ struct rcu_head rcu_node; /* For call_rcu teardown. */
};
struct relay_session *session_create(const char *session_name,
- const char *hostname, const char *base_path,
- uint32_t live_timer,
- bool snapshot,
- const lttng_uuid& sessiond_uuid,
- const uint64_t *id_sessiond,
- const uint64_t *current_chunk_id,
- const time_t *creation_time,
- uint32_t major,
- uint32_t minor,
- bool session_name_contains_creation_timestamp);
+ const char *hostname,
+ const char *base_path,
+ uint32_t live_timer,
+ bool snapshot,
+ const lttng_uuid& sessiond_uuid,
+ const uint64_t *id_sessiond,
+ const uint64_t *current_chunk_id,
+ const time_t *creation_time,
+ uint32_t major,
+ uint32_t minor,
+ bool session_name_contains_creation_timestamp);
struct relay_session *session_get_by_id(uint64_t id);
bool session_get(struct relay_session *session);
void session_put(struct relay_session *session);
#ifndef SESSIOND_TRACE_CHUNK_REGISTRY_H
#define SESSIOND_TRACE_CHUNK_REGISTRY_H
-#include <common/uuid.hpp>
#include <common/trace-chunk.hpp>
+#include <common/uuid.hpp>
+
#include <stdint.h>
/*
*/
struct sessiond_trace_chunk_registry;
-struct sessiond_trace_chunk_registry *
-sessiond_trace_chunk_registry_create(void);
+struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create(void);
-void sessiond_trace_chunk_registry_destroy(
- struct sessiond_trace_chunk_registry *sessiond_registry);
+void sessiond_trace_chunk_registry_destroy(struct sessiond_trace_chunk_registry *sessiond_registry);
int sessiond_trace_chunk_registry_session_created(
- struct sessiond_trace_chunk_registry *sessiond_registry,
- const lttng_uuid& sessiond_uuid);
+ struct sessiond_trace_chunk_registry *sessiond_registry, const lttng_uuid& sessiond_uuid);
int sessiond_trace_chunk_registry_session_destroyed(
- struct sessiond_trace_chunk_registry *sessiond_registry,
- const lttng_uuid& sessiond_uuid);
-
-struct lttng_trace_chunk *sessiond_trace_chunk_registry_publish_chunk(
- struct sessiond_trace_chunk_registry *sessiond_registry,
- const lttng_uuid& sessiond_uuid, uint64_t session_id,
- struct lttng_trace_chunk *chunk);
+ struct sessiond_trace_chunk_registry *sessiond_registry, const lttng_uuid& sessiond_uuid);
struct lttng_trace_chunk *
-sessiond_trace_chunk_registry_get_anonymous_chunk(
- struct sessiond_trace_chunk_registry *sessiond_registry,
- const lttng_uuid& sessiond_uuid,
- uint64_t session_id);
+sessiond_trace_chunk_registry_publish_chunk(struct sessiond_trace_chunk_registry *sessiond_registry,
+ const lttng_uuid& sessiond_uuid,
+ uint64_t session_id,
+ struct lttng_trace_chunk *chunk);
+
+struct lttng_trace_chunk *sessiond_trace_chunk_registry_get_anonymous_chunk(
+ struct sessiond_trace_chunk_registry *sessiond_registry,
+ const lttng_uuid& sessiond_uuid,
+ uint64_t session_id);
struct lttng_trace_chunk *
-sessiond_trace_chunk_registry_get_chunk(
- struct sessiond_trace_chunk_registry *sessiond_registry,
- const lttng_uuid& sessiond_uuid,
- uint64_t session_id, uint64_t chunk_id);
+sessiond_trace_chunk_registry_get_chunk(struct sessiond_trace_chunk_registry *sessiond_registry,
+ const lttng_uuid& sessiond_uuid,
+ uint64_t session_id,
+ uint64_t chunk_id);
int sessiond_trace_chunk_registry_chunk_exists(
- struct sessiond_trace_chunk_registry *sessiond_registry,
- const lttng_uuid& sessiond_uuid,
- uint64_t session_id, uint64_t chunk_id, bool *chunk_exists);
+ struct sessiond_trace_chunk_registry *sessiond_registry,
+ const lttng_uuid& sessiond_uuid,
+ uint64_t session_id,
+ uint64_t chunk_id,
+ bool *chunk_exists);
#endif /* SESSIOND_TRACE_CHUNK_REGISTRY_H */
*
*/
-#include <limits.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <urcu/list.h>
+#include "session.hpp"
+#include "tracefile-array.hpp"
+#include <common/buffer-view.hpp>
#include <common/hashtable/hashtable.hpp>
-#include <common/trace-chunk.hpp>
#include <common/optional.hpp>
-#include <common/buffer-view.hpp>
+#include <common/trace-chunk.hpp>
-#include "session.hpp"
-#include "tracefile-array.hpp"
+#include <inttypes.h>
+#include <limits.h>
+#include <pthread.h>
+#include <urcu/list.h>
struct lttcomm_relayd_index;
*/
struct tracefile_array *tfa;
- bool closed; /* Stream is closed. */
- bool close_requested; /* Close command has been received. */
+ bool closed; /* Stream is closed. */
+ bool close_requested; /* Close command has been received. */
/*
* Counts number of indexes in indexes_ht. Redundant info.
* Node of stream within global stream hash table.
*/
struct lttng_ht_node_u64 node;
- bool in_stream_ht; /* is stream in stream hash table. */
- struct rcu_head rcu_node; /* For call_rcu teardown. */
+ bool in_stream_ht; /* is stream in stream hash table. */
+ struct rcu_head rcu_node; /* For call_rcu teardown. */
/*
* The trace chunk to which the file currently being produced (if any)
* belongs.
};
struct relay_stream *stream_create(struct ctf_trace *trace,
- uint64_t stream_handle, char *path_name,
- char *channel_name, uint64_t tracefile_size,
- uint64_t tracefile_count);
+ uint64_t stream_handle,
+ char *path_name,
+ char *channel_name,
+ uint64_t tracefile_size,
+ uint64_t tracefile_count);
struct relay_stream *stream_get_by_id(uint64_t stream_id);
bool stream_get(struct relay_stream *stream);
void stream_put(struct relay_stream *stream);
-int stream_rotate_output_files(struct relay_session *session,
- struct relay_stream *stream);
+int stream_rotate_output_files(struct relay_session *session, struct relay_stream *stream);
int stream_set_pending_rotation(struct relay_stream *stream,
- struct lttng_trace_chunk *next_trace_chunk,
- uint64_t rotation_sequence_number);
+ struct lttng_trace_chunk *next_trace_chunk,
+ uint64_t rotation_sequence_number);
void try_stream_close(struct relay_stream *stream);
void stream_publish(struct relay_stream *stream);
-int stream_init_packet(struct relay_stream *stream, size_t packet_size,
- bool *file_rotated);
+int stream_init_packet(struct relay_stream *stream, size_t packet_size, bool *file_rotated);
int stream_write(struct relay_stream *stream,
- const struct lttng_buffer_view *packet, size_t padding_len);
+ const struct lttng_buffer_view *packet,
+ size_t padding_len);
/* Called after the reception of a complete data packet. */
-int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
- bool rotate_index, bool *flushed, uint64_t total_size);
+int stream_update_index(struct relay_stream *stream,
+ uint64_t net_seq_num,
+ bool rotate_index,
+ bool *flushed,
+ uint64_t total_size);
int stream_complete_packet(struct relay_stream *stream,
- size_t packet_total_size, uint64_t sequence_number,
- bool index_flushed);
+ size_t packet_total_size,
+ uint64_t sequence_number,
+ bool index_flushed);
/* Index info is in host endianness. */
-int stream_add_index(struct relay_stream *stream,
- const struct lttcomm_relayd_index *index_info);
+int stream_add_index(struct relay_stream *stream, const struct lttcomm_relayd_index *index_info);
int stream_reset_file(struct relay_stream *stream);
void print_relay_streams(void);
*
*/
-#include <limits.h>
#include <inttypes.h>
+#include <limits.h>
#include <pthread.h>
#include <stdbool.h>
struct tracefile {
/* Per-tracefile head/tail seq. */
- uint64_t seq_head; /* Newest seqcount. Inclusive. */
- uint64_t seq_tail; /* Oldest seqcount. Inclusive. */
+ uint64_t seq_head; /* Newest seqcount. Inclusive. */
+ uint64_t seq_tail; /* Oldest seqcount. Inclusive. */
};
enum tracefile_rotate_type {
void tracefile_array_destroy(struct tracefile_array *tfa);
void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type);
-void tracefile_array_commit_seq(struct tracefile_array *tfa,
- uint64_t new_seq_head);
+void tracefile_array_commit_seq(struct tracefile_array *tfa, uint64_t new_seq_head);
void tracefile_array_reset(struct tracefile_array *tfa);
uint64_t tracefile_array_get_read_file_index_head(struct tracefile_array *tfa);
/* May return -1ULL in the case where we have not received any indexes yet. */
uint64_t tracefile_array_get_seq_tail(struct tracefile_array *tfa);
-bool tracefile_array_seq_in_file(struct tracefile_array *tfa,
- uint64_t file_index, uint64_t seq);
+bool tracefile_array_seq_in_file(struct tracefile_array *tfa, uint64_t file_index, uint64_t seq);
#endif /* _STREAM_H */
*
*/
-#include <limits.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <urcu/list.h>
-#include <urcu/ref.h>
+#include "lttng-viewer-abi.hpp"
+#include "session.hpp"
#include <common/hashtable/hashtable.hpp>
#include <common/trace-chunk.hpp>
-#include "session.hpp"
-#include "lttng-viewer-abi.hpp"
+#include <inttypes.h>
+#include <limits.h>
+#include <pthread.h>
+#include <urcu/list.h>
+#include <urcu/ref.h>
struct relay_viewer_session {
/*
* This list limits the design to having the sessions in at most
* one viewer session.
*/
- struct cds_list_head session_list; /* RCU list. */
- pthread_mutex_t session_list_lock; /* Protects list updates. */
+ struct cds_list_head session_list; /* RCU list. */
+ pthread_mutex_t session_list_lock; /* Protects list updates. */
/*
* The viewer session's current trace chunk is initially set, when
* a viewer attaches to the viewer session, to a copy the corresponding
void viewer_session_destroy(struct relay_viewer_session *vsession);
void viewer_session_close(struct relay_viewer_session *vsession);
-enum lttng_viewer_attach_return_code viewer_session_attach(
- struct relay_viewer_session *vsession,
- struct relay_session *session);
+enum lttng_viewer_attach_return_code viewer_session_attach(struct relay_viewer_session *vsession,
+ struct relay_session *session);
int viewer_session_is_attached(struct relay_viewer_session *vsession,
- struct relay_session *session);
+ struct relay_session *session);
void viewer_session_close_one_session(struct relay_viewer_session *vsession,
- struct relay_session *session);
+ struct relay_session *session);
int viewer_session_set_trace_chunk_copy(struct relay_viewer_session *vsession,
- struct lttng_trace_chunk *relay_session_trace_chunk);
+ struct lttng_trace_chunk *relay_session_trace_chunk);
#endif /* _VIEWER_SESSION_H */
*
*/
-#include <limits.h>
-#include <inttypes.h>
-#include <pthread.h>
-
-#include <common/hashtable/hashtable.hpp>
-
#include "ctf-trace.hpp"
#include "lttng-viewer-abi.hpp"
#include "stream.hpp"
+#include <common/hashtable/hashtable.hpp>
+
+#include <inttypes.h>
+#include <limits.h>
+#include <pthread.h>
+
struct relay_stream;
/*
};
struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
- struct lttng_trace_chunk *viewer_trace_chunk,
- enum lttng_viewer_seek seek_t);
+ struct lttng_trace_chunk *viewer_trace_chunk,
+ enum lttng_viewer_seek seek_t);
struct relay_viewer_stream *viewer_stream_get_by_id(uint64_t id);
bool viewer_stream_get(struct relay_viewer_stream *vstream);
void viewer_stream_put(struct relay_viewer_stream *vstream);
int viewer_stream_rotate(struct relay_viewer_stream *vstream);
-bool viewer_stream_is_tracefile_seq_readable(struct relay_viewer_stream *vstream,
- uint64_t seq);
+bool viewer_stream_is_tracefile_seq_readable(struct relay_viewer_stream *vstream, uint64_t seq);
void print_viewer_streams(void);
void viewer_stream_close_files(struct relay_viewer_stream *vstream);
void viewer_stream_sync_tracefile_array_tail(struct relay_viewer_stream *vstream);
ACTION_EXECUTOR_STATUS_INVALID,
};
-struct action_executor *action_executor_create(
- struct notification_thread_handle *handle);
+struct action_executor *action_executor_create(struct notification_thread_handle *handle);
void action_executor_destroy(struct action_executor *executor);
* This function assumes the ownership of the `evaluation` both on success and
* failure: the caller should no longer access it once the function returns.
*/
-enum action_executor_status action_executor_enqueue_trigger(
- struct action_executor *executor,
- struct lttng_trigger *trigger,
- struct lttng_evaluation *evaluation,
- const struct lttng_credentials *object_creds,
- struct notification_client_list *list);
+enum action_executor_status
+action_executor_enqueue_trigger(struct action_executor *executor,
+ struct lttng_trigger *trigger,
+ struct lttng_evaluation *evaluation,
+ const struct lttng_credentials *object_creds,
+ struct notification_client_list *list);
#endif /* ACTION_EXECUTOR_H */
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline
-bool launch_agent_management_thread(void)
+static inline bool launch_agent_management_thread(void)
{
return true;
}
-static inline
-bool agent_tracing_is_enabled(void)
+static inline bool agent_tracing_is_enabled(void)
{
return false;
}
#ifndef LTTNG_SESSIOND_AGENT_H
#define LTTNG_SESSIOND_AGENT_H
-#include <inttypes.h>
-
#include <common/hashtable/hashtable.hpp>
+
#include <lttng/lttng.h>
+#include <inttypes.h>
+
/* Agent protocol version that is verified during the agent registration. */
-#define AGENT_MAJOR_VERSION 2
-#define AGENT_MINOR_VERSION 0
+#define AGENT_MAJOR_VERSION 2
+#define AGENT_MINOR_VERSION 0
/*
* Hash table that contains the agent app created upon registration indexed by
/* Agent event API. */
struct agent_event *agent_create_event(const char *name,
- enum lttng_loglevel_type loglevel_type, int loglevel_value,
- struct lttng_bytecode *filter,
- char *filter_expression);
+ enum lttng_loglevel_type loglevel_type,
+ int loglevel_value,
+ struct lttng_bytecode *filter,
+ char *filter_expression);
void agent_add_event(struct agent_event *event, struct agent *agt);
struct agent_event *agent_find_event(const char *name,
- enum lttng_loglevel_type loglevel_type,
- int loglevel_value,
- const char *filter_expression,
- struct agent *agt);
-void agent_find_events_by_name(const char *name, struct agent *agt,
- struct lttng_ht_iter* iter);
-void agent_event_next_duplicate(const char *name,
- struct agent *agt, struct lttng_ht_iter* iter);
+ enum lttng_loglevel_type loglevel_type,
+ int loglevel_value,
+ const char *filter_expression,
+ struct agent *agt);
+void agent_find_events_by_name(const char *name, struct agent *agt, struct lttng_ht_iter *iter);
+void agent_event_next_duplicate(const char *name, struct agent *agt, struct lttng_ht_iter *iter);
void agent_delete_event(struct agent_event *event, struct agent *agt);
void agent_destroy_event(struct agent_event *event);
/* Agent context API.*/
-int agent_enable_context(const struct lttng_event_context *ctx,
- enum lttng_domain_type domain);
-int agent_add_context(const struct lttng_event_context *ctx,
- struct agent *agt);
+int agent_enable_context(const struct lttng_event_context *ctx, enum lttng_domain_type domain);
+int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt);
/* Agent app API. */
-struct agent_app *agent_create_app(pid_t pid, enum lttng_domain_type domain,
- struct lttcomm_sock *sock);
+struct agent_app *
+agent_create_app(pid_t pid, enum lttng_domain_type domain, struct lttcomm_sock *sock);
void agent_add_app(struct agent_app *app);
void agent_delete_app(struct agent_app *app);
struct agent_app *agent_find_app_by_sock(int sock);
int agent_send_registration_done(struct agent_app *app);
/* Agent action API */
-int agent_enable_event(struct agent_event *event,
- enum lttng_domain_type domain);
-int agent_disable_event(struct agent_event *event,
- enum lttng_domain_type domain);
+int agent_enable_event(struct agent_event *event, enum lttng_domain_type domain);
+int agent_disable_event(struct agent_event *event, enum lttng_domain_type domain);
void agent_update(const struct agent *agt, const struct agent_app *app);
-int agent_list_events(struct lttng_event **events,
- enum lttng_domain_type domain);
+int agent_list_events(struct lttng_event **events, enum lttng_domain_type domain);
-struct agent_event *agent_find_event_by_trigger(
- const struct lttng_trigger *trigger, struct agent *agt);
+struct agent_event *agent_find_event_by_trigger(const struct lttng_trigger *trigger,
+ struct agent *agt);
/* Global event notifier per-domain agents. */
-struct agent *agent_find_by_event_notifier_domain(
- enum lttng_domain_type domain_type);
+struct agent *agent_find_by_event_notifier_domain(enum lttng_domain_type domain_type);
void agent_by_event_notifier_domain_ht_destroy(void);
int agent_by_event_notifier_domain_ht_create(void);
#ifndef LTTNG_BUFFER_REGISTRY_H
#define LTTNG_BUFFER_REGISTRY_H
-#include <stdint.h>
-#include <urcu/list.h>
-
-#include <lttng/lttng.h>
-#include <common/hashtable/hashtable.hpp>
-
#include "consumer.hpp"
#include "lttng-ust-ctl.hpp"
-#include "ust-registry.hpp"
#include "ust-registry-session.hpp"
+#include "ust-registry.hpp"
+
+#include <common/hashtable/hashtable.hpp>
+
+#include <lttng/lttng.h>
+
+#include <stdint.h>
+#include <urcu/list.h>
struct buffer_reg_stream {
struct cds_list_head lnode;
* Keys to match this object in a hash table. The following three variables
* identify a unique per UID buffer registry.
*/
- uint64_t session_id; /* Unique tracing session id. */
- int bits_per_long; /* ABI */
- uid_t uid; /* Owner. */
+ uint64_t session_id; /* Unique tracing session id. */
+ int bits_per_long; /* ABI */
+ uid_t uid; /* Owner. */
enum lttng_domain_type domain;
struct buffer_reg_session *registry;
/* Buffer registry per UID. */
void buffer_reg_init_uid_registry(void);
-int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid,
- enum lttng_domain_type domain, struct buffer_reg_uid **regp,
- const char *root_shm_path, const char *shm_path);
+int buffer_reg_uid_create(uint64_t session_id,
+ uint32_t bits_per_long,
+ uid_t uid,
+ enum lttng_domain_type domain,
+ struct buffer_reg_uid **regp,
+ const char *root_shm_path,
+ const char *shm_path);
void buffer_reg_uid_add(struct buffer_reg_uid *reg);
-struct buffer_reg_uid *buffer_reg_uid_find(uint64_t session_id,
- uint32_t bits_per_long, uid_t uid);
+struct buffer_reg_uid *buffer_reg_uid_find(uint64_t session_id, uint32_t bits_per_long, uid_t uid);
void buffer_reg_uid_remove(struct buffer_reg_uid *regp);
-void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
- struct consumer_output *consumer);
+void buffer_reg_uid_destroy(struct buffer_reg_uid *regp, struct consumer_output *consumer);
/* Buffer registry per PID. */
void buffer_reg_init_pid_registry(void);
-int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp,
- const char *root_shm_path, const char *shm_path);
+int buffer_reg_pid_create(uint64_t session_id,
+ struct buffer_reg_pid **regp,
+ const char *root_shm_path,
+ const char *shm_path);
void buffer_reg_pid_add(struct buffer_reg_pid *reg);
struct buffer_reg_pid *buffer_reg_pid_find(uint64_t session_id);
void buffer_reg_pid_remove(struct buffer_reg_pid *regp);
/* Channel */
int buffer_reg_channel_create(uint64_t key, struct buffer_reg_channel **regp);
-void buffer_reg_channel_add(struct buffer_reg_session *session,
- struct buffer_reg_channel *channel);
-struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key,
- struct buffer_reg_uid *reg);
-void buffer_reg_channel_remove(struct buffer_reg_session *session,
- struct buffer_reg_channel *regp);
-void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
- enum lttng_domain_type domain);
+void buffer_reg_channel_add(struct buffer_reg_session *session, struct buffer_reg_channel *channel);
+struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key, struct buffer_reg_uid *reg);
+void buffer_reg_channel_remove(struct buffer_reg_session *session, struct buffer_reg_channel *regp);
+void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, enum lttng_domain_type domain);
/* Stream */
int buffer_reg_stream_create(struct buffer_reg_stream **regp);
-void buffer_reg_stream_add(struct buffer_reg_stream *stream,
- struct buffer_reg_channel *channel);
-void buffer_reg_stream_destroy(struct buffer_reg_stream *regp,
- enum lttng_domain_type domain);
+void buffer_reg_stream_add(struct buffer_reg_stream *stream, struct buffer_reg_channel *channel);
+void buffer_reg_stream_destroy(struct buffer_reg_stream *regp, enum lttng_domain_type domain);
/* Global registry. */
void buffer_reg_destroy_registries(void);
-int buffer_reg_uid_consumer_channel_key(
- struct cds_list_head *buffer_reg_uid_list,
- uint64_t chan_key, uint64_t *consumer_chan_key);
+int buffer_reg_uid_consumer_channel_key(struct cds_list_head *buffer_reg_uid_list,
+ uint64_t chan_key,
+ uint64_t *consumer_chan_key);
#endif /* LTTNG_BUFFER_REGISTRY_H */
#ifndef _LTT_CHANNEL_H
#define _LTT_CHANNEL_H
-#include <lttng/lttng.h>
-
#include "trace-kernel.hpp"
#include "trace-ust.hpp"
-int channel_kernel_disable(struct ltt_kernel_session *ksession,
- char *channel_name);
+#include <lttng/lttng.h>
+
+int channel_kernel_disable(struct ltt_kernel_session *ksession, char *channel_name);
enum lttng_error_code channel_kernel_enable(struct ltt_kernel_session *ksession,
- struct ltt_kernel_channel *kchan);
+ struct ltt_kernel_channel *kchan);
enum lttng_error_code channel_kernel_create(struct ltt_kernel_session *ksession,
- struct lttng_channel *chan,
- int kernel_pipe);
+ struct lttng_channel *chan,
+ int kernel_pipe);
-struct lttng_channel *channel_new_default_attr(int domain,
- enum lttng_buffer_type type);
+struct lttng_channel *channel_new_default_attr(int domain, enum lttng_buffer_type type);
void channel_attr_destroy(struct lttng_channel *channel);
enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
- struct lttng_channel *attr, enum lttng_buffer_type type);
+ struct lttng_channel *attr,
+ enum lttng_buffer_type type);
enum lttng_error_code channel_ust_enable(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan);
-int channel_ust_disable(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan);
+ struct ltt_ust_channel *uchan);
+int channel_ust_disable(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan);
-struct lttng_channel *trace_ust_channel_to_lttng_channel(
- const struct ltt_ust_channel *uchan);
+struct lttng_channel *trace_ust_channel_to_lttng_channel(const struct ltt_ust_channel *uchan);
#endif /* _LTT_CHANNEL_H */
cmd_ctx->lsm.u.rotation_set_schedule.type;
value = cmd_ctx->lsm.u.rotation_set_schedule.value;
- ret = cmd_rotation_set_schedule(cmd_ctx->session,
- set_schedule,
- schedule_type,
- value);
+ ret = cmd_rotation_set_schedule(
+ cmd_ctx->session, set_schedule, schedule_type, value);
if (ret != LTTNG_OK) {
goto error;
}
#include <common/compat/time.hpp>
#include <common/uuid.hpp>
+
#include <vendor/optional.hpp>
#include <stddef.h>
*
* Called with session lock held.
*/
-int cmd_destroy_session(struct ltt_session *session,
- int *sock_fd)
+int cmd_destroy_session(struct ltt_session *session, int *sock_fd)
{
int ret;
enum lttng_error_code destruction_last_error = LTTNG_OK;
#include "lttng-sessiond.hpp"
#include "lttng/tracker.h"
#include "session.hpp"
+
#include <common/tracker.hpp>
struct notification_thread_handle;
void cmd_init(void);
/* Session commands */
-enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
- struct lttng_session_descriptor **return_descriptor);
+enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
+ int sock,
+ struct lttng_session_descriptor **return_descriptor);
int cmd_destroy_session(struct ltt_session *session, int *sock_fd);
/* Channel commands */
int cmd_disable_channel(struct ltt_session *session,
- enum lttng_domain_type domain, char *channel_name);
+ enum lttng_domain_type domain,
+ char *channel_name);
int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe);
/* Process attribute tracker commands */
-enum lttng_error_code cmd_process_attr_tracker_get_tracking_policy(
- struct ltt_session *session,
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- enum lttng_tracking_policy *policy);
-enum lttng_error_code cmd_process_attr_tracker_set_tracking_policy(
- struct ltt_session *session,
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- enum lttng_tracking_policy policy);
-enum lttng_error_code cmd_process_attr_tracker_inclusion_set_add_value(
- struct ltt_session *session,
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- const struct process_attr_value *value);
-enum lttng_error_code cmd_process_attr_tracker_inclusion_set_remove_value(
- struct ltt_session *session,
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- const struct process_attr_value *value);
-enum lttng_error_code cmd_process_attr_tracker_get_inclusion_set(
- struct ltt_session *session,
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- struct lttng_process_attr_values **values);
+enum lttng_error_code
+cmd_process_attr_tracker_get_tracking_policy(struct ltt_session *session,
+ enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ enum lttng_tracking_policy *policy);
+enum lttng_error_code
+cmd_process_attr_tracker_set_tracking_policy(struct ltt_session *session,
+ enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ enum lttng_tracking_policy policy);
+enum lttng_error_code
+cmd_process_attr_tracker_inclusion_set_add_value(struct ltt_session *session,
+ enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ const struct process_attr_value *value);
+enum lttng_error_code
+cmd_process_attr_tracker_inclusion_set_remove_value(struct ltt_session *session,
+ enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ const struct process_attr_value *value);
+enum lttng_error_code
+cmd_process_attr_tracker_get_inclusion_set(struct ltt_session *session,
+ enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ struct lttng_process_attr_values **values);
/* Event commands */
int cmd_disable_event(struct command_ctx *cmd_ctx,
- struct lttng_event *event,
- char *filter_expression,
- struct lttng_bytecode *filter,
- struct lttng_event_exclusion *exclusion);
+ struct lttng_event *event,
+ char *filter_expression,
+ struct lttng_bytecode *filter,
+ struct lttng_event_exclusion *exclusion);
int cmd_add_context(struct command_ctx *cmd_ctx,
- const struct lttng_event_context *event_context,
- int kwpipe);
-int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
- char *channel_name, struct lttng_event *event,
- struct lttng_bytecode *bytecode);
+ const struct lttng_event_context *event_context,
+ int kwpipe);
+int cmd_set_filter(struct ltt_session *session,
+ enum lttng_domain_type domain,
+ char *channel_name,
+ struct lttng_event *event,
+ struct lttng_bytecode *bytecode);
int cmd_enable_event(struct command_ctx *cmd_ctx,
- struct lttng_event *event,
- char *filter_expression,
- struct lttng_event_exclusion *exclusion,
- struct lttng_bytecode *bytecode,
- int wpipe);
+ struct lttng_event *event,
+ char *filter_expression,
+ struct lttng_event_exclusion *exclusion,
+ struct lttng_bytecode *bytecode,
+ int wpipe);
/* Trace session action commands */
int cmd_start_trace(struct ltt_session *session);
/* Consumer commands */
int cmd_register_consumer(struct ltt_session *session,
- enum lttng_domain_type domain,
- const char *sock_path, struct consumer_data *cdata);
-int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
- struct lttng_uri *uris);
+ enum lttng_domain_type domain,
+ const char *sock_path,
+ struct consumer_data *cdata);
+int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris);
int cmd_setup_relayd(struct ltt_session *session);
/* Listing commands */
-ssize_t cmd_list_domains(struct ltt_session *session,
- struct lttng_domain **domains);
+ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **domains);
enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
- struct ltt_session *session,
- char *channel_name,
- struct lttng_payload *payload);
+ struct ltt_session *session,
+ char *channel_name,
+ struct lttng_payload *payload);
enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
- struct ltt_session *session,
- struct lttng_payload *payload);
+ struct ltt_session *session,
+ struct lttng_payload *payload);
void cmd_list_lttng_sessions(struct lttng_session *sessions,
- size_t session_count, uid_t uid, gid_t gid);
+ size_t session_count,
+ uid_t uid,
+ gid_t gid);
enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
- struct lttng_payload *reply);
+ struct lttng_payload *reply);
enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
- struct lttng_payload *reply_payload);
+ struct lttng_payload *reply_payload);
ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
- struct lttng_snapshot_output **outputs);
-enum lttng_error_code cmd_list_syscalls(
- struct lttng_payload *reply_payload);
+ struct lttng_snapshot_output **outputs);
+enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload);
int cmd_data_pending(struct ltt_session *session);
/* Snapshot */
int cmd_snapshot_add_output(struct ltt_session *session,
- const struct lttng_snapshot_output *output, uint32_t *id);
+ const struct lttng_snapshot_output *output,
+ uint32_t *id);
int cmd_snapshot_del_output(struct ltt_session *session,
- const struct lttng_snapshot_output *output);
+ const struct lttng_snapshot_output *output);
int cmd_snapshot_record(struct ltt_session *session,
- const struct lttng_snapshot_output *output, int wait);
+ const struct lttng_snapshot_output *output,
+ int wait);
-int cmd_set_session_shm_path(struct ltt_session *session,
- const char *shm_path);
+int cmd_set_session_shm_path(struct ltt_session *session, const char *shm_path);
int cmd_regenerate_metadata(struct ltt_session *session);
int cmd_regenerate_statedump(struct ltt_session *session);
-enum lttng_error_code cmd_register_trigger(
- const struct lttng_credentials *cmd_creds,
- struct lttng_trigger *trigger,
- bool is_anonymous_trigger,
- struct notification_thread_handle *notification_thread_handle,
- struct lttng_trigger **return_trigger);
-enum lttng_error_code cmd_unregister_trigger(
- const struct lttng_credentials *cmd_creds,
- const struct lttng_trigger *trigger,
- struct notification_thread_handle *notification_thread_handle);
-
-enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
- struct notification_thread_handle *notification_thread_handle,
- struct lttng_triggers **return_triggers);
-enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
- const struct lttng_error_query *query,
- struct lttng_error_query_results **_results,
- struct notification_thread_handle *notification_thread);
+enum lttng_error_code
+cmd_register_trigger(const struct lttng_credentials *cmd_creds,
+ struct lttng_trigger *trigger,
+ bool is_anonymous_trigger,
+ struct notification_thread_handle *notification_thread_handle,
+ struct lttng_trigger **return_trigger);
+enum lttng_error_code
+cmd_unregister_trigger(const struct lttng_credentials *cmd_creds,
+ const struct lttng_trigger *trigger,
+ struct notification_thread_handle *notification_thread_handle);
+
+enum lttng_error_code
+cmd_list_triggers(struct command_ctx *cmd_ctx,
+ struct notification_thread_handle *notification_thread_handle,
+ struct lttng_triggers **return_triggers);
+enum lttng_error_code
+cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
+ const struct lttng_error_query *query,
+ struct lttng_error_query_results **_results,
+ struct notification_thread_handle *notification_thread);
int cmd_rotate_session(struct ltt_session *session,
- struct lttng_rotate_session_return *rotate_return,
- bool quiet_rotation,
- enum lttng_trace_chunk_command_type command);
+ struct lttng_rotate_session_return *rotate_return,
+ bool quiet_rotation,
+ enum lttng_trace_chunk_command_type command);
int cmd_rotate_get_info(struct ltt_session *session,
- struct lttng_rotation_get_info_return *info_return,
- uint64_t rotate_id);
+ struct lttng_rotation_get_info_return *info_return,
+ uint64_t rotate_id);
int cmd_rotation_set_schedule(struct ltt_session *session,
- bool activate, enum lttng_rotation_schedule_type schedule_type,
- uint64_t value);
+ bool activate,
+ enum lttng_rotation_schedule_type schedule_type,
+ uint64_t value);
const struct cmd_completion_handler *cmd_pop_completion_handler(void);
int start_kernel_session(struct ltt_kernel_session *ksess);
*/
unsigned long lttng_condition_hash(const struct lttng_condition *condition);
-struct lttng_condition *lttng_condition_copy(
- const struct lttng_condition *condition);
+struct lttng_condition *lttng_condition_copy(const struct lttng_condition *condition);
#endif /* LTTNG_SESSIOND_CONDITION_INTERNAL_H */
#ifndef _CONSUMER_H
#define _CONSUMER_H
+#include "snapshot.hpp"
+
#include <common/consumer/consumer.hpp>
#include <common/hashtable/hashtable.hpp>
+
#include <lttng/lttng.h>
-#include <urcu/ref.h>
-#include <algorithm>
-#include "snapshot.hpp"
+#include <algorithm>
+#include <urcu/ref.h>
struct snapshot;
struct snapshot_output;
};
struct consumer_data {
- explicit consumer_data (lttng_consumer_type type_)
- : type(type_)
- {}
+ explicit consumer_data(lttng_consumer_type type_) : type(type_)
+ {
+ }
enum lttng_consumer_type type;
* Consumer output object describing where and how to send data.
*/
struct consumer_output {
- struct urcu_ref ref; /* Refcount */
+ struct urcu_ref ref; /* Refcount */
/* If the consumer is enabled meaning that should be used */
bool enabled;
* Subdirectory path name used for both local and network
* consumer ("kernel", "ust", or empty).
*/
- char domain_subdir[
- max_constexpr(sizeof(DEFAULT_KERNEL_TRACE_DIR),
- sizeof(DEFAULT_UST_TRACE_DIR))];
+ char domain_subdir[max_constexpr(sizeof(DEFAULT_KERNEL_TRACE_DIR),
+ sizeof(DEFAULT_UST_TRACE_DIR))];
/*
* Hashtable of consumer_socket index by the file descriptor value. For
char chunk_path[LTTNG_PATH_MAX];
};
-struct consumer_socket *consumer_find_socket(int key,
- const struct consumer_output *consumer);
+struct consumer_socket *consumer_find_socket(int key, const struct consumer_output *consumer);
struct consumer_socket *consumer_find_socket_by_bitness(int bits,
- const struct consumer_output *consumer);
+ const struct consumer_output *consumer);
struct consumer_socket *consumer_allocate_socket(int *fd);
-void consumer_add_socket(struct consumer_socket *sock,
- struct consumer_output *consumer);
-void consumer_del_socket(struct consumer_socket *sock,
- struct consumer_output *consumer);
+void consumer_add_socket(struct consumer_socket *sock, struct consumer_output *consumer);
+void consumer_del_socket(struct consumer_socket *sock, struct consumer_output *consumer);
void consumer_destroy_socket(struct consumer_socket *sock);
-int consumer_copy_sockets(struct consumer_output *dst,
- struct consumer_output *src);
+int consumer_copy_sockets(struct consumer_output *dst, struct consumer_output *src);
void consumer_destroy_output_sockets(struct consumer_output *obj);
-int consumer_socket_send(struct consumer_socket *socket, const void *msg,
- size_t len);
-int consumer_socket_recv(struct consumer_socket *socket, void *msg,
- size_t len);
+int consumer_socket_send(struct consumer_socket *socket, const void *msg, size_t len);
+int consumer_socket_recv(struct consumer_socket *socket, void *msg, size_t len);
struct consumer_output *consumer_create_output(enum consumer_dst_type type);
struct consumer_output *consumer_copy_output(struct consumer_output *obj);
void consumer_output_get(struct consumer_output *obj);
void consumer_output_put(struct consumer_output *obj);
int consumer_set_network_uri(const struct ltt_session *session,
- struct consumer_output *obj,
- struct lttng_uri *uri);
-int consumer_send_fds(struct consumer_socket *sock, const int *fds,
- size_t nb_fd);
-int consumer_send_msg(struct consumer_socket *sock,
- const struct lttcomm_consumer_msg *msg);
+ struct consumer_output *obj,
+ struct lttng_uri *uri);
+int consumer_send_fds(struct consumer_socket *sock, const int *fds, size_t nb_fd);
+int consumer_send_msg(struct consumer_socket *sock, const struct lttcomm_consumer_msg *msg);
int consumer_send_stream(struct consumer_socket *sock,
- struct consumer_output *dst, struct lttcomm_consumer_msg *msg,
- const int *fds, size_t nb_fd);
-int consumer_send_channel(struct consumer_socket *sock,
- struct lttcomm_consumer_msg *msg);
+ struct consumer_output *dst,
+ struct lttcomm_consumer_msg *msg,
+ const int *fds,
+ size_t nb_fd);
+int consumer_send_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg);
int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
- struct lttcomm_relayd_sock *rsock, struct consumer_output *consumer,
- enum lttng_stream_type type, uint64_t session_id,
- const char *session_name, const char *hostname,
- const char *base_path, int session_live_timer,
- const uint64_t *current_chunk_id, time_t session_creation_time,
- bool session_name_contains_creation_time);
-int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock,
- int pipe);
-int consumer_send_destroy_relayd(struct consumer_socket *sock,
- struct consumer_output *consumer);
+ struct lttcomm_relayd_sock *rsock,
+ struct consumer_output *consumer,
+ enum lttng_stream_type type,
+ uint64_t session_id,
+ const char *session_name,
+ const char *hostname,
+ const char *base_path,
+ int session_live_timer,
+ const uint64_t *current_chunk_id,
+ time_t session_creation_time,
+ bool session_name_contains_creation_time);
+int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, int pipe);
+int consumer_send_destroy_relayd(struct consumer_socket *sock, struct consumer_output *consumer);
int consumer_recv_status_reply(struct consumer_socket *sock);
int consumer_recv_status_channel(struct consumer_socket *sock,
- uint64_t *key, unsigned int *stream_count);
+ uint64_t *key,
+ unsigned int *stream_count);
void consumer_output_send_destroy_relayd(struct consumer_output *consumer);
-int consumer_create_socket(struct consumer_data *data,
- struct consumer_output *output);
+int consumer_create_socket(struct consumer_data *data, struct consumer_output *output);
void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
- uint64_t subbuf_size,
- uint64_t num_subbuf,
- int overwrite,
- unsigned int switch_timer_interval,
- unsigned int read_timer_interval,
- unsigned int live_timer_interval,
- bool is_in_live_session,
- unsigned int monitor_timer_interval,
- int output,
- int type,
- uint64_t session_id,
- const char *pathname,
- const char *name,
- uint64_t relayd_id,
- uint64_t key,
- const lttng_uuid& uuid,
- uint32_t chan_id,
- uint64_t tracefile_size,
- uint64_t tracefile_count,
- uint64_t session_id_per_pid,
- unsigned int monitor,
- uint32_t ust_app_uid,
- int64_t blocking_timeout,
- const char *root_shm_path,
- const char *shm_path,
- struct lttng_trace_chunk *trace_chunk,
- const struct lttng_credentials *buffer_credentials);
+ uint64_t subbuf_size,
+ uint64_t num_subbuf,
+ int overwrite,
+ unsigned int switch_timer_interval,
+ unsigned int read_timer_interval,
+ unsigned int live_timer_interval,
+ bool is_in_live_session,
+ unsigned int monitor_timer_interval,
+ int output,
+ int type,
+ uint64_t session_id,
+ const char *pathname,
+ const char *name,
+ uint64_t relayd_id,
+ uint64_t key,
+ const lttng_uuid& uuid,
+ uint32_t chan_id,
+ uint64_t tracefile_size,
+ uint64_t tracefile_count,
+ uint64_t session_id_per_pid,
+ unsigned int monitor,
+ uint32_t ust_app_uid,
+ int64_t blocking_timeout,
+ const char *root_shm_path,
+ const char *shm_path,
+ struct lttng_trace_chunk *trace_chunk,
+ const struct lttng_credentials *buffer_credentials);
void consumer_init_add_stream_comm_msg(struct lttcomm_consumer_msg *msg,
- uint64_t channel_key,
- uint64_t stream_key,
- int32_t cpu);
+ uint64_t channel_key,
+ uint64_t stream_key,
+ int32_t cpu);
void consumer_init_streams_sent_comm_msg(struct lttcomm_consumer_msg *msg,
- enum lttng_consumer_command cmd,
- uint64_t channel_key, uint64_t net_seq_idx);
+ enum lttng_consumer_command cmd,
+ uint64_t channel_key,
+ uint64_t net_seq_idx);
void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
- uint64_t channel_key,
- uint64_t session_id,
- const char *pathname,
- uint64_t relayd_id,
- const char *name,
- unsigned int nb_init_streams,
- enum lttng_event_output output,
- int type,
- uint64_t tracefile_size,
- uint64_t tracefile_count,
- unsigned int monitor,
- unsigned int live_timer_interval,
- bool is_in_live_session,
- unsigned int monitor_timer_interval,
- struct lttng_trace_chunk *trace_chunk);
-int consumer_is_data_pending(uint64_t session_id,
- struct consumer_output *consumer);
-int consumer_close_metadata(struct consumer_socket *socket,
- uint64_t metadata_key);
-int consumer_setup_metadata(struct consumer_socket *socket,
- uint64_t metadata_key);
+ uint64_t channel_key,
+ uint64_t session_id,
+ const char *pathname,
+ uint64_t relayd_id,
+ const char *name,
+ unsigned int nb_init_streams,
+ enum lttng_event_output output,
+ int type,
+ uint64_t tracefile_size,
+ uint64_t tracefile_count,
+ unsigned int monitor,
+ unsigned int live_timer_interval,
+ bool is_in_live_session,
+ unsigned int monitor_timer_interval,
+ struct lttng_trace_chunk *trace_chunk);
+int consumer_is_data_pending(uint64_t session_id, struct consumer_output *consumer);
+int consumer_close_metadata(struct consumer_socket *socket, uint64_t metadata_key);
+int consumer_setup_metadata(struct consumer_socket *socket, uint64_t metadata_key);
int consumer_push_metadata(struct consumer_socket *socket,
- uint64_t metadata_key, char *metadata_str, size_t len,
- size_t target_offset, uint64_t version);
+ uint64_t metadata_key,
+ char *metadata_str,
+ size_t len,
+ size_t target_offset,
+ uint64_t version);
int consumer_flush_channel(struct consumer_socket *socket, uint64_t key);
int consumer_clear_quiescent_channel(struct consumer_socket *socket, uint64_t key);
-int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key,
- struct consumer_output *consumer, uint64_t *discarded);
-int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key,
- struct consumer_output *consumer, uint64_t *lost);
+int consumer_get_discarded_events(uint64_t session_id,
+ uint64_t channel_key,
+ struct consumer_output *consumer,
+ uint64_t *discarded);
+int consumer_get_lost_packets(uint64_t session_id,
+ uint64_t channel_key,
+ struct consumer_output *consumer,
+ uint64_t *lost);
/* Snapshot command. */
enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
- uint64_t key, const struct consumer_output *output, int metadata,
- const char *channel_path, uint64_t nb_packets_per_stream);
+ uint64_t key,
+ const struct consumer_output *output,
+ int metadata,
+ const char *channel_path,
+ uint64_t nb_packets_per_stream);
/* Rotation commands. */
-int consumer_rotate_channel(struct consumer_socket *socket, uint64_t key,
- struct consumer_output *output, bool is_metadata_channel);
-int consumer_init(struct consumer_socket *socket,
- const lttng_uuid& sessiond_uuid);
+int consumer_rotate_channel(struct consumer_socket *socket,
+ uint64_t key,
+ struct consumer_output *output,
+ bool is_metadata_channel);
+int consumer_init(struct consumer_socket *socket, const lttng_uuid& sessiond_uuid);
int consumer_create_trace_chunk(struct consumer_socket *socket,
- uint64_t relayd_id, uint64_t session_id,
- struct lttng_trace_chunk *chunk,
- const char *domain_subdir);
+ uint64_t relayd_id,
+ uint64_t session_id,
+ struct lttng_trace_chunk *chunk,
+ const char *domain_subdir);
int consumer_close_trace_chunk(struct consumer_socket *socket,
- uint64_t relayd_id, uint64_t session_id,
- struct lttng_trace_chunk *chunk,
- char *closed_trace_chunk_path);
+ uint64_t relayd_id,
+ uint64_t session_id,
+ struct lttng_trace_chunk *chunk,
+ char *closed_trace_chunk_path);
int consumer_trace_chunk_exists(struct consumer_socket *socket,
- uint64_t relayd_id, uint64_t session_id,
- struct lttng_trace_chunk *chunk,
- enum consumer_trace_chunk_exists_status *result);
+ uint64_t relayd_id,
+ uint64_t session_id,
+ struct lttng_trace_chunk *chunk,
+ enum consumer_trace_chunk_exists_status *result);
int consumer_open_channel_packets(struct consumer_socket *socket, uint64_t key);
char *setup_channel_trace_path(struct consumer_output *consumer,
- const char *session_path, size_t *consumer_path_offset);
+ const char *session_path,
+ size_t *consumer_path_offset);
/* Clear command */
int consumer_clear_channel(struct consumer_socket *socket, uint64_t key);
#ifndef _LTT_CONTEXT_H
#define _LTT_CONTEXT_H
-#include <lttng/lttng.h>
-
+#include "lttng-ust-ctl.hpp"
#include "trace-kernel.hpp"
#include "trace-ust.hpp"
-#include "lttng-ust-ctl.hpp"
+
+#include <lttng/lttng.h>
int context_kernel_add(struct ltt_kernel_session *ksession,
- const struct lttng_event_context *ctx,
- const char *channel_name);
+ const struct lttng_event_context *ctx,
+ const char *channel_name);
int context_ust_add(struct ltt_ust_session *usess,
- enum lttng_domain_type domain,
- const struct lttng_event_context *ctx,
- const char *channel_name);
+ enum lttng_domain_type domain,
+ const struct lttng_event_context *ctx,
+ const char *channel_name);
#endif /* _LTT_CONTEXT_H */
#ifndef LTTNG_CTF2_TRACE_CLASS_VISITOR_H
#define LTTNG_CTF2_TRACE_CLASS_VISITOR_H
-#include "trace-class.hpp"
-#include "stream-class.hpp"
#include "event-class.hpp"
+#include "stream-class.hpp"
+#include "trace-class.hpp"
-#include <vendor/optional.hpp>
#include <vendor/nlohmann/json.hpp>
+#include <vendor/optional.hpp>
#include <functional>
#ifndef SESSIOND_UST_DISPATCH_THREAD_H
#define SESSIOND_UST_DISPATCH_THREAD_H
-#include <stdbool.h>
#include "lttng-sessiond.hpp"
+#include <stdbool.h>
+
bool launch_ust_dispatch_thread(struct ust_cmd_queue *cmd_queue,
- int apps_cmd_pipe_write_fd,
- int apps_cmd_notify_write_fd);
+ int apps_cmd_pipe_write_fd,
+ int apps_cmd_notify_write_fd);
#endif /* SESSIOND_UST_DISPATCH_THREAD_H */
#include "field.hpp"
#include <common/uuid.hpp>
+
#include <vendor/optional.hpp>
#include <string>
protected:
event_class(unsigned int id,
- unsigned int stream_class_id,
- int log_level,
- std::string name,
- nonstd::optional<std::string> model_emf_uri,
- lttng::sessiond::trace::type::cuptr payload);
+ unsigned int stream_class_id,
+ int log_level,
+ std::string name,
+ nonstd::optional<std::string> model_emf_uri,
+ lttng::sessiond::trace::type::cuptr payload);
};
} /* namespace trace */
#ifndef _EVENT_NOTIFIER_ERROR_ACCOUNTING_H
#define _EVENT_NOTIFIER_ERROR_ACCOUNTING_H
-#include <stdint.h>
+#include "ust-app.hpp"
#include <lttng/trigger/trigger.h>
-#include "ust-app.hpp"
+#include <stdint.h>
enum event_notifier_error_accounting_status {
EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK,
* to be allocated for each domain.
*/
enum event_notifier_error_accounting_status
-event_notifier_error_accounting_init(uint64_t buffer_size_kernel,
- uint64_t buffer_size_ust);
+event_notifier_error_accounting_init(uint64_t buffer_size_kernel, uint64_t buffer_size_ust);
/*
* Register the kernel event notifier group.
* This allocates the counter object on the kernel side.
*/
enum event_notifier_error_accounting_status
-event_notifier_error_accounting_register_kernel(
- int kernel_event_notifier_group_fd);
+event_notifier_error_accounting_register_kernel(int kernel_event_notifier_group_fd);
#ifdef HAVE_LIBLTTNG_UST_CTL
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline
-enum event_notifier_error_accounting_status
-event_notifier_error_accounting_register_app(
- struct ust_app *app __attribute__((unused)))
+static inline enum event_notifier_error_accounting_status
+event_notifier_error_accounting_register_app(struct ust_app *app __attribute__((unused)))
{
return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
}
-static inline
-enum event_notifier_error_accounting_status
-event_notifier_error_accounting_unregister_app(
- struct ust_app *app __attribute__((unused)))
+static inline enum event_notifier_error_accounting_status
+event_notifier_error_accounting_unregister_app(struct ust_app *app __attribute__((unused)))
{
return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
}
* Allocates, reserves and returns the error counter index for that trigger.
*/
enum event_notifier_error_accounting_status
-event_notifier_error_accounting_register_event_notifier(
- const struct lttng_trigger *trigger,
- uint64_t *error_counter_index);
+event_notifier_error_accounting_register_event_notifier(const struct lttng_trigger *trigger,
+ uint64_t *error_counter_index);
enum event_notifier_error_accounting_status
-event_notifier_error_accounting_get_count(
- const struct lttng_trigger *trigger,
- uint64_t *count);
+event_notifier_error_accounting_get_count(const struct lttng_trigger *trigger, uint64_t *count);
-void event_notifier_error_accounting_unregister_event_notifier(
- const struct lttng_trigger *trigger);
+void event_notifier_error_accounting_unregister_event_notifier(const struct lttng_trigger *trigger);
void event_notifier_error_accounting_fini(void);
LTTNG_ASSERT(usess);
LTTNG_ASSERT(uchan);
-
/* Disabling existing events */
{
lttng::urcu::read_lock_guard read_lock;
struct agent;
int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
- const char *event_name, enum lttng_event_type event_type);
+ const char *event_name,
+ enum lttng_event_type event_type);
int event_kernel_enable_event(struct ltt_kernel_channel *kchan,
- struct lttng_event *event, char *filter_expression,
- struct lttng_bytecode *filter);
+ struct lttng_event *event,
+ char *filter_expression,
+ struct lttng_bytecode *filter);
int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct lttng_event *event,
- char *filter_expression,
- struct lttng_bytecode *filter,
- struct lttng_event_exclusion *exclusion,
- bool internal_event);
+ struct ltt_ust_channel *uchan,
+ struct lttng_event *event,
+ char *filter_expression,
+ struct lttng_bytecode *filter,
+ struct lttng_event_exclusion *exclusion,
+ bool internal_event);
int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, const char *event_name);
-
-int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan);
-
-int event_agent_enable(struct ltt_ust_session *usess, struct agent *agt,
- struct lttng_event *event, struct lttng_bytecode *filter,
- char *filter_expression);
-int event_agent_enable_all(struct ltt_ust_session *usess, struct agent *agt,
- struct lttng_event *event, struct lttng_bytecode *filter,
- char *filter_expression);
-
-int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
- const char *event_name);
+ struct ltt_ust_channel *uchan,
+ const char *event_name);
+
+int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan);
+
+int event_agent_enable(struct ltt_ust_session *usess,
+ struct agent *agt,
+ struct lttng_event *event,
+ struct lttng_bytecode *filter,
+ char *filter_expression);
+int event_agent_enable_all(struct ltt_ust_session *usess,
+ struct agent *agt,
+ struct lttng_event *event,
+ struct lttng_bytecode *filter,
+ char *filter_expression);
+
+int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, const char *event_name);
int event_agent_disable_all(struct ltt_ust_session *usess, struct agent *agt);
-int trigger_agent_enable(
- const struct lttng_trigger *trigger, struct agent *agt);
-int trigger_agent_disable(
- const struct lttng_trigger *trigger, struct agent *agt);
+int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt);
+int trigger_agent_disable(const struct lttng_trigger *trigger, struct agent *agt);
const char *event_get_default_agent_ust_name(enum lttng_domain_type domain);
using roles = std::vector<role>;
integer_type(unsigned int alignment,
- byte_order byte_order,
- unsigned int size,
- signedness signedness,
- base base,
- roles roles = {});
+ byte_order byte_order,
+ unsigned int size,
+ signedness signedness,
+ base base,
+ roles roles = {});
type::cuptr copy() const override;
class floating_point_type : public type {
public:
floating_point_type(unsigned int alignment,
- byte_order byte_order,
- unsigned int exponent_digits,
- unsigned int mantissa_digits);
+ byte_order byte_order,
+ unsigned int exponent_digits,
+ unsigned int mantissa_digits);
type::cuptr copy() const final;
using range_integer_t = MappingIntegerType;
enumeration_mapping_range(MappingIntegerType in_begin, MappingIntegerType in_end) :
- begin{in_begin}, end{in_end}
+ begin{ in_begin }, end{ in_end }
{
}
using mappings = std::vector<mapping>;
static_assert(std::is_integral<MappingIntegerType>::value &&
- sizeof(MappingIntegerType) == 8,
- "MappingIntegerType must be either int64_t or uint64_t");
+ sizeof(MappingIntegerType) == 8,
+ "MappingIntegerType must be either int64_t or uint64_t");
typed_enumeration_type(unsigned int in_alignment,
- enum byte_order in_byte_order,
- unsigned int in_size,
- enum base in_base,
- const std::shared_ptr<const mappings>& in_mappings,
- integer_type::roles in_roles = {}) :
+ enum byte_order in_byte_order,
+ unsigned int in_size,
+ enum base in_base,
+ const std::shared_ptr<const mappings>& in_mappings,
+ integer_type::roles in_roles = {}) :
enumeration_type(in_alignment,
- in_byte_order,
- in_size,
- std::is_signed<MappingIntegerType>::value ?
- integer_type::signedness::SIGNED :
- integer_type::signedness::UNSIGNED,
- in_base,
- std::move(in_roles)),
- mappings_{std::move(in_mappings)}
+ in_byte_order,
+ in_size,
+ std::is_signed<MappingIntegerType>::value ?
+ integer_type::signedness::SIGNED :
+ integer_type::signedness::UNSIGNED,
+ in_base,
+ std::move(in_roles)),
+ mappings_{ std::move(in_mappings) }
{
}
type::cuptr copy() const override
{
return lttng::make_unique<typed_enumeration_type<MappingIntegerType>>(
- alignment, byte_order, size, base_, mappings_, roles_);
+ alignment, byte_order, size, base_, mappings_, roles_);
}
void accept(type_visitor& visitor) const final;
private:
bool _is_equal(const type& base_other) const noexcept final
{
- const auto& other = static_cast<const typed_enumeration_type<MappingIntegerType>&>(
- base_other);
+ const auto& other =
+ static_cast<const typed_enumeration_type<MappingIntegerType>&>(base_other);
return integer_type::_is_equal(base_other) && *this->mappings_ == *other.mappings_;
}
class static_length_array_type : public array_type {
public:
static_length_array_type(unsigned int alignment,
- type::cuptr element_type,
- uint64_t in_length);
+ type::cuptr element_type,
+ uint64_t in_length);
type::cuptr copy() const final;
class dynamic_length_array_type : public array_type {
public:
dynamic_length_array_type(unsigned int alignment,
- type::cuptr element_type,
- field_location length_field_location);
+ type::cuptr element_type,
+ field_location length_field_location);
type::cuptr copy() const final;
class static_length_string_type : public string_type {
public:
- static_length_string_type(
- unsigned int alignment, enum encoding in_encoding, uint64_t length);
+ static_length_string_type(unsigned int alignment,
+ enum encoding in_encoding,
+ uint64_t length);
type::cuptr copy() const final;
class dynamic_length_string_type : public string_type {
public:
dynamic_length_string_type(unsigned int alignment,
- enum encoding in_encoding,
- field_location length_field_location);
+ enum encoding in_encoding,
+ field_location length_field_location);
type::cuptr copy() const final;
template <typename MappingIntegerType>
class variant_type : public type {
- static_assert(std::is_same<MappingIntegerType,
- unsigned_enumeration_type::mapping::range_t::
- range_integer_t>::value ||
- std::is_same<MappingIntegerType,
- signed_enumeration_type::mapping::range_t::
- range_integer_t>::value,
- "Variant mapping integer type must be one of those allowed by typed_enumeration_type");
+ static_assert(
+ std::is_same<MappingIntegerType,
+ unsigned_enumeration_type::mapping::range_t::range_integer_t>::value ||
+ std::is_same<
+ MappingIntegerType,
+ signed_enumeration_type::mapping::range_t::range_integer_t>::value,
+ "Variant mapping integer type must be one of those allowed by typed_enumeration_type");
public:
- using choice = std::pair<const details::enumeration_mapping<MappingIntegerType>, type::cuptr>;
+ using choice =
+ std::pair<const details::enumeration_mapping<MappingIntegerType>, type::cuptr>;
using choices = std::vector<choice>;
variant_type(unsigned int in_alignment,
- field_location in_selector_field_location,
- choices in_choices) :
+ field_location in_selector_field_location,
+ choices in_choices) :
type(in_alignment),
- selector_field_location{std::move(in_selector_field_location)},
- choices_{std::move(in_choices)}
+ selector_field_location{ std::move(in_selector_field_location) },
+ choices_{ std::move(in_choices) }
{
}
copy_of_choices.reserve(choices_.size());
for (const auto& current_choice : choices_) {
- copy_of_choices.emplace_back(
- current_choice.first, current_choice.second->copy());
+ copy_of_choices.emplace_back(current_choice.first,
+ current_choice.second->copy());
}
return lttng::make_unique<variant_type<MappingIntegerType>>(
return false;
}
- return std::equal(a.cbegin(), a.cend(), b.cbegin(),
- [](const choice& choice_a, const choice& choice_b) {
- return choice_a.first == choice_b.first &&
- *choice_a.second == *choice_b.second;
- });
+ return std::equal(a.cbegin(),
+ a.cend(),
+ b.cbegin(),
+ [](const choice& choice_a, const choice& choice_b) {
+ return choice_a.first == choice_b.first &&
+ *choice_a.second == *choice_b.second;
+ });
}
bool _is_equal(const type& base_other) const noexcept final
const auto& other = static_cast<decltype(*this)&>(base_other);
return selector_field_location == other.selector_field_location &&
- _choices_are_equal(choices_, other.choices_);
+ _choices_are_equal(choices_, other.choices_);
}
};
virtual void visit(const static_length_string_type& type) = 0;
virtual void visit(const dynamic_length_string_type& type) = 0;
virtual void visit(const structure_type& type) = 0;
- virtual void visit(const variant_type<signed_enumeration_type::mapping::range_t::range_integer_t>& type) = 0;
- virtual void visit(const variant_type<unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) = 0;
+ virtual void
+ visit(const variant_type<signed_enumeration_type::mapping::range_t::range_integer_t>&
+ type) = 0;
+ virtual void
+ visit(const variant_type<unsigned_enumeration_type::mapping::range_t::range_integer_t>&
+ type) = 0;
protected:
type_visitor() = default;
template <>
struct formatter<lttng::sessiond::trace::field_location> : formatter<std::string> {
template <typename FormatContextType>
- typename FormatContextType::iterator format(
- const lttng::sessiond::trace::field_location& location, FormatContextType& ctx)
+ typename FormatContextType::iterator
+ format(const lttng::sessiond::trace::field_location& location, FormatContextType& ctx)
{
- std::string location_str{"["};
+ std::string location_str{ "[" };
switch (location.root_) {
case lttng::sessiond::trace::field_location::root::PACKET_HEADER:
break;
}
- for (const auto &name : location.elements_) {
+ for (const auto& name : location.elements_) {
location_str += ", \"" + name + "\"";
}
namespace details {
template <typename MappingIntegerType>
::std::string format_mapping_range(typename lttng::sessiond::trace::typed_enumeration_type<
- MappingIntegerType>::mapping::range_t range)
+ MappingIntegerType>::mapping::range_t range)
{
if (range.begin == range.end) {
return ::fmt::format("[{}]", range.begin);
template <typename FormatContextType>
typename FormatContextType::iterator
format(typename lttng::sessiond::trace::signed_enumeration_type::mapping::range_t range,
- FormatContextType& ctx)
+ FormatContextType& ctx)
{
return format_to(ctx.out(),
- details::format_mapping_range<
- lttng::sessiond::trace::signed_enumeration_type::
- mapping::range_t::range_integer_t>(
- range));
+ details::format_mapping_range<
+ lttng::sessiond::trace::signed_enumeration_type::mapping::
+ range_t::range_integer_t>(range));
}
};
template <typename FormatContextType>
typename FormatContextType::iterator
format(typename lttng::sessiond::trace::unsigned_enumeration_type::mapping::range_t range,
- FormatContextType& ctx)
+ FormatContextType& ctx)
{
return format_to(ctx.out(),
- details::format_mapping_range<
- lttng::sessiond::trace::unsigned_enumeration_type::
- mapping::range_t::range_integer_t>(
- range));
+ details::format_mapping_range<
+ lttng::sessiond::trace::unsigned_enumeration_type::
+ mapping::range_t::range_integer_t>(range));
}
};
*/
#include <lttng/health-internal.hpp>
+
#include <stdbool.h>
enum health_type_sessiond {
- HEALTH_SESSIOND_TYPE_CMD = 0,
- HEALTH_SESSIOND_TYPE_APP_MANAGE = 1,
- HEALTH_SESSIOND_TYPE_APP_REG = 2,
- HEALTH_SESSIOND_TYPE_KERNEL = 3,
- HEALTH_SESSIOND_TYPE_CONSUMER = 4,
- HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY = 6,
- HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH = 7,
- HEALTH_SESSIOND_TYPE_NOTIFICATION = 8,
- HEALTH_SESSIOND_TYPE_ROTATION = 9,
- HEALTH_SESSIOND_TYPE_TIMER = 10,
- HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR = 11,
+ HEALTH_SESSIOND_TYPE_CMD = 0,
+ HEALTH_SESSIOND_TYPE_APP_MANAGE = 1,
+ HEALTH_SESSIOND_TYPE_APP_REG = 2,
+ HEALTH_SESSIOND_TYPE_KERNEL = 3,
+ HEALTH_SESSIOND_TYPE_CONSUMER = 4,
+ HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY = 6,
+ HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH = 7,
+ HEALTH_SESSIOND_TYPE_NOTIFICATION = 8,
+ HEALTH_SESSIOND_TYPE_ROTATION = 9,
+ HEALTH_SESSIOND_TYPE_TIMER = 10,
+ HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR = 11,
NR_HEALTH_SESSIOND_TYPES,
};
/*
* Compatible lttng-modules version.
*/
-#define KERN_MODULES_PRE_MAJOR 1
-#define KERN_MODULES_PRE_MINOR 9
+#define KERN_MODULES_PRE_MAJOR 1
+#define KERN_MODULES_PRE_MINOR 9
-#define KERN_MODULES_MAJOR 2
-#define KERN_MODULES_MINOR 0
+#define KERN_MODULES_MAJOR 2
+#define KERN_MODULES_MINOR 0
enum kernel_module_property_load_policy {
KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED = 0,
struct kern_modules_param {
char *name;
- enum kernel_module_property_load_policy load_policy;
+ enum kernel_module_property_load_policy load_policy;
bool loaded;
};
*
*/
-#include <sys/types.h>
+#include "trace-kernel.hpp"
#include <common/sessiond-comm/sessiond-comm.hpp>
-#include "trace-kernel.hpp"
+#include <sys/types.h>
int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
- struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
- unsigned int monitor);
+ struct ltt_kernel_channel *channel,
+ struct ltt_kernel_session *session,
+ unsigned int monitor);
-int kernel_consumer_send_session(struct consumer_socket *sock,
- struct ltt_kernel_session *session);
+int kernel_consumer_send_session(struct consumer_socket *sock, struct ltt_kernel_session *session);
int kernel_consumer_add_metadata(struct consumer_socket *sock,
- struct ltt_kernel_session *session, unsigned int monitor);
+ struct ltt_kernel_session *session,
+ unsigned int monitor);
int kernel_consumer_destroy_channel(struct consumer_socket *socket,
- struct ltt_kernel_channel *channel);
+ struct ltt_kernel_channel *channel);
int kernel_consumer_destroy_metadata(struct consumer_socket *socket,
- struct ltt_kernel_metadata *metadata);
+ struct ltt_kernel_metadata *metadata);
int kernel_consumer_streams_sent(struct consumer_socket *sock,
- struct ltt_kernel_session *session, uint64_t channel_key);
+ struct ltt_kernel_session *session,
+ uint64_t channel_key);
return raw_offset;
}
#endif
-}
+} /* namespace */
/*
* Add context on a kernel channel.
*/
#define KERNEL_EVENT_INIT_LIST_SIZE 64
-int kernel_add_channel_context(struct ltt_kernel_channel *chan,
- struct ltt_kernel_context *ctx);
+int kernel_add_channel_context(struct ltt_kernel_channel *chan, struct ltt_kernel_context *ctx);
int kernel_create_session(struct ltt_session *session);
-int kernel_create_channel(struct ltt_kernel_session *session,
- struct lttng_channel *chan);
-int kernel_create_event(struct lttng_event *ev, struct ltt_kernel_channel *channel,
- char *filter_expression, struct lttng_bytecode *filter);
+int kernel_create_channel(struct ltt_kernel_session *session, struct lttng_channel *chan);
+int kernel_create_event(struct lttng_event *ev,
+ struct ltt_kernel_channel *channel,
+ char *filter_expression,
+ struct lttng_bytecode *filter);
int kernel_disable_channel(struct ltt_kernel_channel *chan);
int kernel_disable_event(struct ltt_kernel_event *event);
int kernel_enable_event(struct ltt_kernel_event *event);
int kernel_enable_channel(struct ltt_kernel_channel *chan);
-enum lttng_error_code kernel_process_attr_tracker_set_tracking_policy(
- struct ltt_kernel_session *session,
- enum lttng_process_attr process_attr,
- enum lttng_tracking_policy policy);
-enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
- struct ltt_kernel_session *session,
- enum lttng_process_attr process_attr,
- const struct process_attr_value *value);
-enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
- struct ltt_kernel_session *session,
- enum lttng_process_attr process_attr,
- const struct process_attr_value *value);
-const struct process_attr_tracker *kernel_get_process_attr_tracker(
- struct ltt_kernel_session *session,
- enum lttng_process_attr process_attr);
+enum lttng_error_code
+kernel_process_attr_tracker_set_tracking_policy(struct ltt_kernel_session *session,
+ enum lttng_process_attr process_attr,
+ enum lttng_tracking_policy policy);
+enum lttng_error_code
+kernel_process_attr_tracker_inclusion_set_add_value(struct ltt_kernel_session *session,
+ enum lttng_process_attr process_attr,
+ const struct process_attr_value *value);
+enum lttng_error_code
+kernel_process_attr_tracker_inclusion_set_remove_value(struct ltt_kernel_session *session,
+ enum lttng_process_attr process_attr,
+ const struct process_attr_value *value);
+const struct process_attr_tracker *
+kernel_get_process_attr_tracker(struct ltt_kernel_session *session,
+ enum lttng_process_attr process_attr);
int kernel_open_metadata(struct ltt_kernel_session *session);
int kernel_open_metadata_stream(struct ltt_kernel_session *session);
int kernel_open_channel_stream(struct ltt_kernel_channel *channel);
ssize_t kernel_list_events(struct lttng_event **event_list);
void kernel_wait_quiescent(void);
int kernel_validate_version(struct lttng_kernel_abi_tracer_version *kernel_tracer_version,
- struct lttng_kernel_abi_tracer_abi_version *kernel_tracer_abi_version);
+ struct lttng_kernel_abi_tracer_abi_version *kernel_tracer_abi_version);
void kernel_destroy_session(struct ltt_kernel_session *ksess);
void kernel_free_session(struct ltt_kernel_session *ksess);
void kernel_destroy_channel(struct ltt_kernel_channel *kchan);
-enum lttng_error_code kernel_snapshot_record(
- struct ltt_kernel_session *ksess,
- const struct consumer_output *output,
- uint64_t nb_packets_per_stream);
+enum lttng_error_code kernel_snapshot_record(struct ltt_kernel_session *ksess,
+ const struct consumer_output *output,
+ uint64_t nb_packets_per_stream);
int kernel_syscall_mask(int chan_fd, char **syscall_mask, uint32_t *nr_bits);
enum lttng_error_code kernel_rotate_session(struct ltt_session *session);
enum lttng_error_code kernel_clear_session(struct ltt_session *session);
void cleanup_kernel_tracer(void);
bool kernel_tracer_is_initialized(void);
-enum lttng_error_code kernel_create_channel_subdirectories(
- const struct ltt_kernel_session *ksess);
+enum lttng_error_code kernel_create_channel_subdirectories(const struct ltt_kernel_session *ksess);
-enum lttng_error_code kernel_create_event_notifier_group_notification_fd(
- int *event_notifier_group_notification_fd);
-enum lttng_error_code kernel_destroy_event_notifier_group_notification_fd(
- int event_notifier_group_notification_fd);
+enum lttng_error_code
+kernel_create_event_notifier_group_notification_fd(int *event_notifier_group_notification_fd);
+enum lttng_error_code
+kernel_destroy_event_notifier_group_notification_fd(int event_notifier_group_notification_fd);
-enum lttng_error_code kernel_register_event_notifier(
- struct lttng_trigger *trigger,
- const struct lttng_credentials *cmd_creds);
-enum lttng_error_code kernel_unregister_event_notifier(
- const struct lttng_trigger *trigger);
+enum lttng_error_code kernel_register_event_notifier(struct lttng_trigger *trigger,
+ const struct lttng_credentials *cmd_creds);
+enum lttng_error_code kernel_unregister_event_notifier(const struct lttng_trigger *trigger);
int kernel_get_notification_fd(void);
enum consumerd_state {
CONSUMER_STARTED = 1,
CONSUMER_STOPPED = 2,
- CONSUMER_ERROR = 3,
+ CONSUMER_ERROR = 3,
};
/* Unique identifier of a session daemon instance. */
#ifndef LTTNG_SYSCALL_H
#define LTTNG_SYSCALL_H
+#include "trace-kernel.hpp"
+
#include <common/hashtable/hashtable.hpp>
-#include <lttng/event.h>
-#include "trace-kernel.hpp"
+#include <lttng/event.h>
/*
* Default size of the kernel system call array. With this size, we usually
* reallocate twice considering a 32 bit compat layer also.
*/
-#define SYSCALL_TABLE_INIT_SIZE 256
+#define SYSCALL_TABLE_INIT_SIZE 256
/* Maximum length of a syscall name. */
-#define SYSCALL_NAME_LEN 255
+#define SYSCALL_NAME_LEN 255
/*
* Represent a kernel syscall and used when we are populating the internal
}
try {
- the_rotation_thread_handle =
- lttng::make_unique<lttng::sessiond::rotation_thread>(
- *rotation_timer_queue, *the_notification_thread_handle);
+ the_rotation_thread_handle = lttng::make_unique<lttng::sessiond::rotation_thread>(
+ *rotation_timer_queue, *the_notification_thread_handle);
} catch (const std::exception& e) {
retval = -1;
ERR("Failed to create rotation thread: %s", e.what());
#ifndef SESSIOND_APPLICATION_MANAGEMENT_THREAD_H
#define SESSIOND_APPLICATION_MANAGEMENT_THREAD_H
-#include <stdbool.h>
#include "lttng-sessiond.hpp"
+#include <stdbool.h>
+
bool launch_application_management_thread(int apps_cmd_pipe_read_fd);
#endif /* SESSIOND_APPLICATION_MANAGEMENT_THREAD_H */
#ifndef SESSIOND_CONSUMER_MANAGEMENT_THREAD_H
#define SESSIOND_CONSUMER_MANAGEMENT_THREAD_H
-#include <stdbool.h>
#include "lttng-sessiond.hpp"
+#include <stdbool.h>
+
bool launch_consumer_management_thread(struct consumer_data *consumer_data);
#endif /* SESSIOND_CONSUMER_MANAGEMENT_THREAD_H */
#ifndef SESSIOND_KERNEL_MANAGEMENT_THREAD_H
#define SESSIOND_KERNEL_MANAGEMENT_THREAD_H
-#include <stdbool.h>
#include "lttng-sessiond.hpp"
+#include <stdbool.h>
+
bool launch_kernel_management_thread(int kernel_poll_pipe_read_fd);
#endif /* SESSIOND_KERNEL_MANAGEMENT_THREAD_H */
#ifndef NOTIFICATION_THREAD_COMMANDS_H
#define NOTIFICATION_THREAD_COMMANDS_H
-#include <lttng/domain.h>
-#include <lttng/lttng-error.h>
-#include <urcu/rculfhash.h>
-#include "notification-thread.hpp"
-#include "notification-thread-internal.hpp"
#include "notification-thread-events.hpp"
+#include "notification-thread-internal.hpp"
+#include "notification-thread.hpp"
+
#include <common/waiter.hpp>
+
+#include <lttng/domain.h>
+#include <lttng/lttng-error.h>
+
#include <stdbool.h>
+#include <urcu/rculfhash.h>
struct notification_thread_data;
struct lttng_trigger;
bool is_async;
};
-enum lttng_error_code notification_thread_command_register_trigger(
- struct notification_thread_handle *handle,
- struct lttng_trigger *trigger,
- bool is_anonymous_trigger);
-
-enum lttng_error_code notification_thread_command_unregister_trigger(
- struct notification_thread_handle *handle,
- const struct lttng_trigger *trigger);
-
-enum lttng_error_code notification_thread_command_add_session(
- struct notification_thread_handle *handle,
- uint64_t session_id,
- const char *session_name,
- uid_t session_uid,
- gid_t session_gid);
-
-enum lttng_error_code notification_thread_command_remove_session(
- struct notification_thread_handle *handle,
- uint64_t session_id);
-
-enum lttng_error_code notification_thread_command_add_channel(
- struct notification_thread_handle *handle,
- uint64_t session_id,
- char *channel_name, uint64_t key,
- enum lttng_domain_type domain, uint64_t capacity);
+enum lttng_error_code
+notification_thread_command_register_trigger(struct notification_thread_handle *handle,
+ struct lttng_trigger *trigger,
+ bool is_anonymous_trigger);
+
+enum lttng_error_code
+notification_thread_command_unregister_trigger(struct notification_thread_handle *handle,
+ const struct lttng_trigger *trigger);
+
+enum lttng_error_code
+notification_thread_command_add_session(struct notification_thread_handle *handle,
+ uint64_t session_id,
+ const char *session_name,
+ uid_t session_uid,
+ gid_t session_gid);
+
+enum lttng_error_code
+notification_thread_command_remove_session(struct notification_thread_handle *handle,
+ uint64_t session_id);
+
+enum lttng_error_code
+notification_thread_command_add_channel(struct notification_thread_handle *handle,
+ uint64_t session_id,
+ char *channel_name,
+ uint64_t key,
+ enum lttng_domain_type domain,
+ uint64_t capacity);
enum lttng_error_code notification_thread_command_remove_channel(
- struct notification_thread_handle *handle,
- uint64_t key, enum lttng_domain_type domain);
+ struct notification_thread_handle *handle, uint64_t key, enum lttng_domain_type domain);
-enum lttng_error_code notification_thread_command_session_rotation_ongoing(
- struct notification_thread_handle *handle,
- uint64_t session_id,
- uint64_t trace_archive_chunk_id);
+enum lttng_error_code
+notification_thread_command_session_rotation_ongoing(struct notification_thread_handle *handle,
+ uint64_t session_id,
+ uint64_t trace_archive_chunk_id);
/* Ownership of location is transferred. */
enum lttng_error_code notification_thread_command_session_rotation_completed(
- struct notification_thread_handle *handle,
- uint64_t session_id,
- uint64_t trace_archive_chunk_id,
- struct lttng_trace_archive_location *location);
+ struct notification_thread_handle *handle,
+ uint64_t session_id,
+ uint64_t trace_archive_chunk_id,
+ struct lttng_trace_archive_location *location);
/*
* Return the set of triggers visible to a given client.
*
* The caller has the exclusive ownership of the returned trigger set.
*/
-enum lttng_error_code notification_thread_command_list_triggers(
- struct notification_thread_handle *handle,
- uid_t client_uid,
- struct lttng_triggers **triggers);
+enum lttng_error_code
+notification_thread_command_list_triggers(struct notification_thread_handle *handle,
+ uid_t client_uid,
+ struct lttng_triggers **triggers);
/*
* The ownership of trigger_event_application_pipe is _not_ transferred to
* the notification thread.
*/
-enum lttng_error_code notification_thread_command_add_tracer_event_source(
- struct notification_thread_handle *handle,
- int tracer_event_source_fd,
- enum lttng_domain_type domain);
-
-enum lttng_error_code notification_thread_command_remove_tracer_event_source(
- struct notification_thread_handle *handle,
- int tracer_event_source_fd);
-
-void notification_thread_command_quit(
- struct notification_thread_handle *handle);
-
-enum lttng_error_code notification_thread_command_get_trigger(
- struct notification_thread_handle *handle,
- const struct lttng_trigger *trigger,
- struct lttng_trigger **real_trigger);
+enum lttng_error_code
+notification_thread_command_add_tracer_event_source(struct notification_thread_handle *handle,
+ int tracer_event_source_fd,
+ enum lttng_domain_type domain);
+
+enum lttng_error_code
+notification_thread_command_remove_tracer_event_source(struct notification_thread_handle *handle,
+ int tracer_event_source_fd);
+
+void notification_thread_command_quit(struct notification_thread_handle *handle);
+
+enum lttng_error_code
+notification_thread_command_get_trigger(struct notification_thread_handle *handle,
+ const struct lttng_trigger *trigger,
+ struct lttng_trigger **real_trigger);
#endif /* NOTIFICATION_THREAD_COMMANDS_H */
#ifndef NOTIFICATION_THREAD_EVENTS_H
#define NOTIFICATION_THREAD_EVENTS_H
-#include <lttng/domain.h>
#include "notification-thread.hpp"
+#include <lttng/domain.h>
+
/**
* Event handling function shall only return an error if
* the thread should be stopped.
*/
-int handle_notification_thread_command(
- struct notification_thread_handle *handle,
- struct notification_thread_state *state);
+int handle_notification_thread_command(struct notification_thread_handle *handle,
+ struct notification_thread_state *state);
-int handle_notification_thread_client_connect(
- struct notification_thread_state *state);
+int handle_notification_thread_client_connect(struct notification_thread_state *state);
-int handle_notification_thread_client_disconnect(
- int client_fd,
- struct notification_thread_state *state);
+int handle_notification_thread_client_disconnect(int client_fd,
+ struct notification_thread_state *state);
-int handle_notification_thread_client_disconnect_all(
- struct notification_thread_state *state);
+int handle_notification_thread_client_disconnect_all(struct notification_thread_state *state);
-int handle_notification_thread_trigger_unregister_all(
- struct notification_thread_state *state);
+int handle_notification_thread_trigger_unregister_all(struct notification_thread_state *state);
-int handle_notification_thread_tracer_event_source_died(
- struct notification_thread_state *state,
- int tracer_event_source_fd);
+int handle_notification_thread_tracer_event_source_died(struct notification_thread_state *state,
+ int tracer_event_source_fd);
-int handle_notification_thread_client_in(
- struct notification_thread_state *state,
- int socket);
+int handle_notification_thread_client_in(struct notification_thread_state *state, int socket);
-int handle_notification_thread_client_out(
- struct notification_thread_state *state,
- int socket);
+int handle_notification_thread_client_out(struct notification_thread_state *state, int socket);
-int handle_notification_thread_channel_sample(
- struct notification_thread_state *state, int pipe,
- enum lttng_domain_type domain);
+int handle_notification_thread_channel_sample(struct notification_thread_state *state,
+ int pipe,
+ enum lttng_domain_type domain);
-int handle_notification_thread_event_notification(
- struct notification_thread_state *state, int pipe,
- enum lttng_domain_type domain);
+int handle_notification_thread_event_notification(struct notification_thread_state *state,
+ int pipe,
+ enum lttng_domain_type domain);
#endif /* NOTIFICATION_THREAD_EVENTS_H */
#ifndef NOTIFICATION_THREAD_INTERNAL_H
#define NOTIFICATION_THREAD_INTERNAL_H
+#include "notification-thread.hpp"
+
#include <common/compat/socket.hpp>
#include <common/credentials.hpp>
#include <common/payload.hpp>
+
#include <lttng/notification/channel-internal.hpp>
#include <lttng/ref-internal.hpp>
+
#include <stdbool.h>
#include <unistd.h>
+#include <urcu/call-rcu.h>
#include <urcu/rculfhash.h>
#include <urcu/ref.h>
-#include <urcu/call-rcu.h>
-#include "notification-thread.hpp"
struct lttng_evaluation;
struct notification_thread_handle;
enum client_transmission_status,
void *);
-int notification_client_list_send_evaluation(
- struct notification_client_list *list,
- const struct lttng_trigger *trigger,
- const struct lttng_evaluation *evaluation,
- const struct lttng_credentials *source_object_creds,
- report_client_transmission_result_cb client_report,
- void *user_data);
+int notification_client_list_send_evaluation(struct notification_client_list *list,
+ const struct lttng_trigger *trigger,
+ const struct lttng_evaluation *evaluation,
+ const struct lttng_credentials *source_object_creds,
+ report_client_transmission_result_cb client_report,
+ void *user_data);
int notification_thread_client_communication_update(
- struct notification_thread_handle *handle,
- notification_client_id id,
- enum client_transmission_status transmission_status);
+ struct notification_thread_handle *handle,
+ notification_client_id id,
+ enum client_transmission_status transmission_status);
/*
* Takes ownership of the payload if present.
*/
struct lttng_event_notifier_notification *lttng_event_notifier_notification_create(
- uint64_t tracer_token,
- enum lttng_domain_type domain,
- char *payload,
- size_t payload_size);
+ uint64_t tracer_token, enum lttng_domain_type domain, char *payload, size_t payload_size);
void lttng_event_notifier_notification_destroy(
- struct lttng_event_notifier_notification *event_notifier_notification);
+ struct lttng_event_notifier_notification *event_notifier_notification);
#endif /* NOTIFICATION_THREAD_INTERNAL_H */
#include "action-executor.hpp"
#include "thread.hpp"
+
#include <common/compat/poll.hpp>
#include <common/hashtable/hashtable.hpp>
#include <common/pipe.hpp>
-#include <lttng/trigger/trigger.h>
+
#include <lttng/domain.h>
+#include <lttng/trigger/trigger.h>
+
#include <pthread.h>
#include <semaphore.h>
#include <urcu.h>
* for lookup on registration.
* - tracer_event_sources_list:
* A list of tracer event source (read side fd) of type
-* struct notification_event_tracer_event_source_element.
-*
+ * struct notification_event_tracer_event_source_element.
+ *
*
* The thread reacts to the following internal events:
* 1) creation of a tracing channel,
};
/* notification_thread_data takes ownership of the channel monitor pipes. */
-struct notification_thread_handle *notification_thread_handle_create(
- struct lttng_pipe *ust32_channel_monitor_pipe,
- struct lttng_pipe *ust64_channel_monitor_pipe,
- struct lttng_pipe *kernel_channel_monitor_pipe);
-void notification_thread_handle_destroy(
- struct notification_thread_handle *handle);
-struct lttng_thread *launch_notification_thread(
- struct notification_thread_handle *handle);
+struct notification_thread_handle *
+notification_thread_handle_create(struct lttng_pipe *ust32_channel_monitor_pipe,
+ struct lttng_pipe *ust64_channel_monitor_pipe,
+ struct lttng_pipe *kernel_channel_monitor_pipe);
+void notification_thread_handle_destroy(struct notification_thread_handle *handle);
+struct lttng_thread *launch_notification_thread(struct notification_thread_handle *handle);
#endif /* NOTIFICATION_THREAD_H */
#else /* HAVE_LIBLTTNG_UST_CTL */
-static
-bool launch_application_notification_thread(
- int apps_cmd_notify_pipe_read_fd __attribute__((unused)))
+static bool launch_application_notification_thread(int apps_cmd_notify_pipe_read_fd
+ __attribute__((unused)))
{
return true;
}
#ifndef SESSIOND_APPLICATION_REGISTRATION_THREAD_H
#define SESSIOND_APPLICATION_REGISTRATION_THREAD_H
-#include <stdbool.h>
#include "lttng-sessiond.hpp"
-struct lttng_thread *launch_application_registration_thread(
- struct ust_cmd_queue *cmd_queue);
+#include <stdbool.h>
+
+struct lttng_thread *launch_application_registration_thread(struct ust_cmd_queue *cmd_queue);
#endif /* SESSIOND_APPLICATION_REGISTRATION_THREAD_H */
free(queue);
}
-ls::rotation_thread::rotation_thread(
- rotation_thread_timer_queue& rotation_timer_queue,
- notification_thread_handle& notification_thread_handle) :
+ls::rotation_thread::rotation_thread(rotation_thread_timer_queue& rotation_timer_queue,
+ notification_thread_handle& notification_thread_handle) :
_rotation_timer_queue{ rotation_timer_queue },
_notification_thread_handle{ notification_thread_handle }
{
}
void ls::rotation_thread_enqueue_job(ls::rotation_thread_timer_queue *queue,
- ls::rotation_thread_job_type job_type,
- ltt_session *session)
+ ls::rotation_thread_job_type job_type,
+ ltt_session *session)
{
const char dummy = '!';
struct rotation_thread_job *job = nullptr;
}
session_lock_list();
- const auto unlock_list = lttng::make_scope_exit([]() noexcept { session_unlock_list(); });
+ const auto unlock_list =
+ lttng::make_scope_exit([]() noexcept { session_unlock_list(); });
/* locked_ptr will unlock the session and release the ref held by the job. */
session_lock(job->session);
}
}
-void ls::rotation_thread::_handle_notification(const lttng_notification ¬ification)
+void ls::rotation_thread::_handle_notification(const lttng_notification& notification)
{
int ret = 0;
const char *condition_session_name = nullptr;
}
if (fd == _notification_channel_subscribtion_change_eventfd.fd()) {
- _notification_channel_subscribtion_change_eventfd.decrement();
+ _notification_channel_subscribtion_change_eventfd
+ .decrement();
}
} else {
/* Job queue or quit pipe activity. */
}
void ls::rotation_thread::subscribe_session_consumed_size_rotation(ltt_session& session,
- std::uint64_t size)
+ std::uint64_t size)
{
const struct lttng_credentials session_creds = {
.uid = LTTNG_OPTIONAL_INIT_VALUE(session.uid),
"Could not set session consumed size condition threshold: size={}", size));
}
- condition_status = lttng_condition_session_consumed_size_set_session_name(rotate_condition.get(),
- session.name);
+ condition_status = lttng_condition_session_consumed_size_set_session_name(
+ rotate_condition.get(), session.name);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
LTTNG_THROW_ERROR(fmt::format(
"Could not set session consumed size condition session name: name=`{}`",
/* trigger acquires its own reference to condition and action on success. */
auto trigger = lttng::make_unique_wrapper<lttng_trigger, lttng_trigger_put>(
lttng_trigger_create(rotate_condition.get(), notify_action.get()));
- if (!trigger)
- {
+ if (!trigger) {
LTTNG_THROW_POSIX("Could not create size-based rotation trigger", errno);
}
lttng_trigger_set_hidden(trigger.get());
lttng_trigger_set_credentials(trigger.get(), &session_creds);
- auto nc_status =
- lttng_notification_channel_subscribe(_notification_channel.get(), rotate_condition.get());
+ auto nc_status = lttng_notification_channel_subscribe(_notification_channel.get(),
+ rotate_condition.get());
if (nc_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
LTTNG_THROW_ERROR("Could not subscribe to session consumed size notification");
}
namespace lttng {
namespace sessiond {
-enum class rotation_thread_job_type {
- SCHEDULED_ROTATION,
- CHECK_PENDING_ROTATION
-};
+enum class rotation_thread_job_type { SCHEDULED_ROTATION, CHECK_PENDING_ROTATION };
struct rotation_thread_timer_queue;
using uptr = std::unique_ptr<rotation_thread>;
rotation_thread(rotation_thread_timer_queue& rotation_timer_queue,
- notification_thread_handle& notification_thread_handle);
+ notification_thread_handle& notification_thread_handle);
~rotation_thread();
/* Only use through the lttng_thread facilities. */
#ifndef SAVE_H
#define SAVE_H
-#include <lttng/save.h>
#include <common/compat/socket.hpp>
-int cmd_save_sessions(struct lttng_save_session_attr *attr,
- lttng_sock_cred *creds);
+#include <lttng/save.h>
+
+int cmd_save_sessions(struct lttng_save_session_attr *attr, lttng_sock_cred *creds);
#endif /* SAVE_H */
/*
* Fire each clear notifier once, and remove them from the array.
*/
-void session_notify_clear(ltt_session &session)
+void session_notify_clear(ltt_session& session)
{
size_t i;
const size_t count = lttng_dynamic_array_get_count(&session.clear_notifiers);
*
* Must be called with the session and session_list locks held.
*/
-int session_reset_rotation_state(ltt_session &session, enum lttng_rotation_state result)
+int session_reset_rotation_state(ltt_session& session, enum lttng_rotation_state result)
{
int ret = 0;
#ifndef _LTT_SESSION_H
#define _LTT_SESSION_H
-#include <limits.h>
-#include <stdbool.h>
-#include <urcu/list.h>
+#include "consumer.hpp"
+#include "snapshot.hpp"
+#include "trace-kernel.hpp"
-#include <common/hashtable/hashtable.hpp>
#include <common/dynamic-array.hpp>
+#include <common/hashtable/hashtable.hpp>
#include <common/make-unique-wrapper.hpp>
#include <common/pthread-lock.hpp>
-#include <lttng/rotation.h>
+
#include <lttng/location.h>
#include <lttng/lttng-error.h>
+#include <lttng/rotation.h>
-#include "snapshot.hpp"
-#include "trace-kernel.hpp"
-#include "consumer.hpp"
+#include <limits.h>
+#include <stdbool.h>
+#include <urcu/list.h>
#define ASSERT_SESSION_LIST_LOCKED() LTTNG_ASSERT(session_trylock_list())
*/
struct ltt_session {
using id_t = uint64_t;
- using locked_ptr = std::unique_ptr<ltt_session,
- lttng::details::create_unique_class<ltt_session,
+ using locked_ptr =
+ std::unique_ptr<ltt_session,
+ lttng::details::create_unique_class<
+ ltt_session,
lttng::sessiond::details::locked_session_release>::deleter>;
using sptr = std::shared_ptr<ltt_session>;
char *base_path;
};
-enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
- struct ltt_session **out_session);
+enum lttng_error_code
+session_create(const char *name, uid_t uid, gid_t gid, struct ltt_session **out_session);
void session_lock(struct ltt_session *session);
void session_unlock(struct ltt_session *session);
void session_destroy(struct ltt_session *session);
int session_add_destroy_notifier(struct ltt_session *session,
- ltt_session_destroy_notifier notifier, void *user_data);
+ ltt_session_destroy_notifier notifier,
+ void *user_data);
int session_add_clear_notifier(struct ltt_session *session,
- ltt_session_clear_notifier notifier, void *user_data);
-void session_notify_clear(ltt_session &session);
+ ltt_session_clear_notifier notifier,
+ void *user_data);
+void session_notify_clear(ltt_session& session);
bool session_get(struct ltt_session *session);
void session_put(struct ltt_session *session);
-enum consumer_dst_type session_get_consumer_destination_type(
- const struct ltt_session *session);
-const char *session_get_net_consumer_hostname(
- const struct ltt_session *session);
-void session_get_net_consumer_ports(
- const struct ltt_session *session,
- uint16_t *control_port, uint16_t *data_port);
-struct lttng_trace_archive_location *session_get_trace_archive_location(
- const struct ltt_session *session);
+enum consumer_dst_type session_get_consumer_destination_type(const struct ltt_session *session);
+const char *session_get_net_consumer_hostname(const struct ltt_session *session);
+void session_get_net_consumer_ports(const struct ltt_session *session,
+ uint16_t *control_port,
+ uint16_t *data_port);
+struct lttng_trace_archive_location *
+session_get_trace_archive_location(const struct ltt_session *session);
struct ltt_session *session_find_by_name(const char *name);
struct ltt_session *session_find_by_id(ltt_session::id_t id);
bool session_access_ok(struct ltt_session *session, uid_t uid);
-int session_reset_rotation_state(ltt_session &session,
- enum lttng_rotation_state result);
+int session_reset_rotation_state(ltt_session& session, enum lttng_rotation_state result);
/* Create a new trace chunk object from the session's configuration. */
-struct lttng_trace_chunk *session_create_new_trace_chunk(
- const struct ltt_session *session,
- const struct consumer_output *consumer_output_override,
- const char *session_base_path_override,
- const char *chunk_name_override);
+struct lttng_trace_chunk *
+session_create_new_trace_chunk(const struct ltt_session *session,
+ const struct consumer_output *consumer_output_override,
+ const char *session_base_path_override,
+ const char *chunk_name_override);
/*
* Set `new_trace_chunk` as the session's current trace chunk. A reference
* `current_session_trace_chunk` on success.
*/
int session_set_trace_chunk(struct ltt_session *session,
- struct lttng_trace_chunk *new_trace_chunk,
- struct lttng_trace_chunk **current_session_trace_chunk);
+ struct lttng_trace_chunk *new_trace_chunk,
+ struct lttng_trace_chunk **current_session_trace_chunk);
/*
* Close a chunk on the remote peers of a session. Has no effect on the
* ltt_session itself.
*/
int session_close_trace_chunk(struct ltt_session *session,
- struct lttng_trace_chunk *trace_chunk,
- enum lttng_trace_chunk_command_type close_command,
- char *path);
+ struct lttng_trace_chunk *trace_chunk,
+ enum lttng_trace_chunk_command_type close_command,
+ char *path);
/* Open a packet in all channels of a given session. */
enum lttng_error_code session_open_packets(struct ltt_session *session);
#define LTTNG_SESSIOND_CONFIG_H
#include <common/macros.hpp>
+
#include <stdbool.h>
struct config_string {
#ifndef SNAPSHOT_H
#define SNAPSHOT_H
-#include <limits.h>
-#include <stdint.h>
+#include "consumer.hpp"
#include <common/common.hpp>
#include <common/hashtable/hashtable.hpp>
#include <common/uri.hpp>
-#include "consumer.hpp"
+#include <limits.h>
+#include <stdint.h>
struct consumer_output;
struct ltt_session;
struct snapshot *snapshot_alloc();
void snapshot_destroy(struct snapshot *obj);
int snapshot_init(struct snapshot *obj);
-void snapshot_delete_output(struct snapshot *snapshot,
- struct snapshot_output *output);
-void snapshot_add_output(struct snapshot *snapshot,
- struct snapshot_output *output);
+void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *output);
+void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *output);
/* Snapshot output object. */
struct snapshot_output *snapshot_output_alloc();
void snapshot_output_destroy(struct snapshot_output *obj);
int snapshot_output_init(const struct ltt_session *session,
- uint64_t max_size, const char *name,
- const char *ctrl_url, const char *data_url,
- struct consumer_output *consumer, struct snapshot_output *output,
- struct snapshot *snapshot);
+ uint64_t max_size,
+ const char *name,
+ const char *ctrl_url,
+ const char *data_url,
+ struct consumer_output *consumer,
+ struct snapshot_output *output,
+ struct snapshot *snapshot);
int snapshot_output_init_with_uri(const struct ltt_session *session,
- uint64_t max_size, const char *name,
- struct lttng_uri *uris, size_t nb_uri,
- struct consumer_output *consumer, struct snapshot_output *output,
- struct snapshot *snapshot);
-struct snapshot_output *snapshot_find_output_by_id(uint32_t id,
- struct snapshot *snapshot);
-struct snapshot_output *snapshot_find_output_by_name(const char *name,
- struct snapshot *snapshot);
+ uint64_t max_size,
+ const char *name,
+ struct lttng_uri *uris,
+ size_t nb_uri,
+ struct consumer_output *consumer,
+ struct snapshot_output *output,
+ struct snapshot *snapshot);
+struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot *snapshot);
+struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot);
#endif /* SNAPSHOT_H */
stream_class& operator=(stream_class&&) = delete;
stream_class& operator=(const stream_class&) = delete;
- virtual const type* packet_context() const;
- virtual const type* event_header() const;
- virtual const type* event_context() const;
+ virtual const type *packet_context() const;
+ virtual const type *event_header() const;
+ virtual const type *event_context() const;
const unsigned int id;
/*
protected:
stream_class(unsigned int id,
- enum header_type header_type,
- nonstd::optional<std::string> default_clock_class_name = nonstd::nullopt);
+ enum header_type header_type,
+ nonstd::optional<std::string> default_clock_class_name = nonstd::nullopt);
virtual void _accept_on_event_classes(trace_class_visitor& trace_class_visitor) const = 0;
lttng::sessiond::trace::type::cuptr _packet_context;
* The shutdown and cleanup callbacks are optional.
*/
struct lttng_thread *lttng_thread_create(const char *name,
- lttng_thread_entry_point entry,
- lttng_thread_shutdown_cb shutdown,
- lttng_thread_cleanup_cb cleanup,
- void *thread_data);
+ lttng_thread_entry_point entry,
+ lttng_thread_shutdown_cb shutdown,
+ lttng_thread_cleanup_cb cleanup,
+ void *thread_data);
bool lttng_thread_get(struct lttng_thread *thread);
void lttng_thread_put(struct lttng_thread *thread);
/*
* Call with session and session_list locks held.
*/
-int timer_session_rotation_pending_check_stop(ltt_session &session)
+int timer_session_rotation_pending_check_stop(ltt_session& session)
{
int ret;
/* Start a session's rotation pending check timer (one-shot mode). */
int timer_session_rotation_pending_check_start(struct ltt_session *session,
- unsigned int interval_us);
+ unsigned int interval_us);
/* Stop a session's rotation pending check timer. */
-int timer_session_rotation_pending_check_stop(ltt_session &session);
+int timer_session_rotation_pending_check_stop(ltt_session& session);
/* Start a session's rotation schedule timer. */
int timer_session_rotation_schedule_timer_start(struct ltt_session *session,
- unsigned int interval_us);
+ unsigned int interval_us);
/* Stop a session's rotation schedule timer. */
int timer_session_rotation_schedule_timer_stop(struct ltt_session *session);
-bool launch_timer_thread(
- struct timer_thread_parameters *timer_thread_parameters);
+bool launch_timer_thread(struct timer_thread_parameters *timer_thread_parameters);
#endif /* SESSIOND_TIMER_H */
{
}
- const char* const name;
+ const char *const name;
const ValueType& value;
};
#ifndef _LTT_TRACE_KERNEL_H
#define _LTT_TRACE_KERNEL_H
-#include <urcu/list.h>
+#include "consumer.hpp"
+#include "tracker.hpp"
-#include <lttng/lttng.h>
-#include <common/lttng-kernel.hpp>
-#include <common/lttng-kernel-old.hpp>
#include <common/defaults.hpp>
+#include <common/lttng-kernel-old.hpp>
+#include <common/lttng-kernel.hpp>
-#include "consumer.hpp"
-#include "tracker.hpp"
+#include <lttng/lttng.h>
+
+#include <urcu/list.h>
/* Kernel event list */
struct ltt_kernel_event_list {
/*
* Lookup functions. NULL is returned if not found.
*/
-struct ltt_kernel_event *trace_kernel_get_event_by_name(
- char *name, struct ltt_kernel_channel *channel,
- enum lttng_event_type type);
-struct ltt_kernel_event *trace_kernel_find_event(
- char *name, struct ltt_kernel_channel *channel,
- enum lttng_event_type type,
- struct lttng_bytecode *filter);
-struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
- const char *name, struct ltt_kernel_session *session);
+struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
+ struct ltt_kernel_channel *channel,
+ enum lttng_event_type type);
+struct ltt_kernel_event *trace_kernel_find_event(char *name,
+ struct ltt_kernel_channel *channel,
+ enum lttng_event_type type,
+ struct lttng_bytecode *filter);
+struct ltt_kernel_channel *trace_kernel_get_channel_by_name(const char *name,
+ struct ltt_kernel_session *session);
/*
* Create functions malloc() the data structure.
*/
struct ltt_kernel_session *trace_kernel_create_session();
-struct ltt_kernel_channel *trace_kernel_create_channel(
- struct lttng_channel *chan);
+struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *chan);
enum lttng_error_code trace_kernel_create_event(struct lttng_event *ev,
- char *filter_expression, struct lttng_bytecode *filter,
- struct ltt_kernel_event **kernel_event);
+ char *filter_expression,
+ struct lttng_bytecode *filter,
+ struct ltt_kernel_event **kernel_event);
struct ltt_kernel_metadata *trace_kernel_create_metadata();
-struct ltt_kernel_stream *trace_kernel_create_stream(const char *name,
- unsigned int count);
-struct ltt_kernel_context *trace_kernel_create_context(
- struct lttng_kernel_abi_context *ctx);
+struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, unsigned int count);
+struct ltt_kernel_context *trace_kernel_create_context(struct lttng_kernel_abi_context *ctx);
/* Trigger is only non-const to acquire a reference. */
enum lttng_error_code trace_kernel_create_event_notifier_rule(
- struct lttng_trigger *trigger,
- uint64_t token,
- uint64_t error_counter_index,
- struct ltt_kernel_event_notifier_rule **event_notifier_rule);
-struct ltt_kernel_context *trace_kernel_copy_context(
- struct ltt_kernel_context *ctx);
+ struct lttng_trigger *trigger,
+ uint64_t token,
+ uint64_t error_counter_index,
+ struct ltt_kernel_event_notifier_rule **event_notifier_rule);
+struct ltt_kernel_context *trace_kernel_copy_context(struct ltt_kernel_context *ctx);
enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
- const struct lttng_event_rule *rule,
- struct lttng_kernel_abi_event_notifier *kernel_event_notifier);
+ const struct lttng_event_rule *rule,
+ struct lttng_kernel_abi_event_notifier *kernel_event_notifier);
/*
* Destroy functions free() the data structure and remove from linked list if
#ifndef _LTT_TRACE_UST_H
#define _LTT_TRACE_UST_H
-#include <limits.h>
-#include <urcu/list.h>
+#include "consumer.hpp"
+#include "lttng-ust-ctl.hpp"
#include <common/defaults.hpp>
#include <common/hashtable/hashtable.hpp>
#include <common/tracker.hpp>
+
#include <lttng/lttng.h>
-#include "consumer.hpp"
-#include "lttng-ust-ctl.hpp"
+#include <limits.h>
+#include <urcu/list.h>
struct agent;
/* UST channel */
struct ltt_ust_channel {
- uint64_t id; /* unique id per session. */
+ uint64_t id; /* unique id per session. */
bool enabled;
/*
* A UST channel can be part of a userspace sub-domain such as JUL,
/* UST session */
struct ltt_ust_session {
- uint64_t id; /* Unique identifier of session */
+ uint64_t id; /* Unique identifier of session */
struct ltt_ust_domain_global domain_global;
/* Hash table of agent indexed by agent domain. */
struct lttng_ht *agents;
unsigned int output_traces;
unsigned int snapshot_mode;
unsigned int has_non_default_channel;
- unsigned int live_timer_interval; /* usec */
+ unsigned int live_timer_interval; /* usec */
/* Metadata channel attributes. */
struct lttng_ust_abi_channel_attr metadata_attr;
#ifdef HAVE_LIBLTTNG_UST_CTL
int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key);
-int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node,
- const void *_key);
+int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node, const void *_key);
/*
* Lookup functions. NULL is returned if not found.
*/
struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
- char *name, struct lttng_bytecode *filter,
- enum lttng_ust_abi_loglevel_type loglevel_type, int loglevel_value,
- struct lttng_event_exclusion *exclusion);
-struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
- const char *name);
+ char *name,
+ struct lttng_bytecode *filter,
+ enum lttng_ust_abi_loglevel_type loglevel_type,
+ int loglevel_value,
+ struct lttng_event_exclusion *exclusion);
+struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, const char *name);
struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
- enum lttng_domain_type domain_type);
+ enum lttng_domain_type domain_type);
/*
* Create functions malloc() the data structure.
*/
struct ltt_ust_session *trace_ust_create_session(uint64_t session_id);
struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr,
- enum lttng_domain_type domain);
+ enum lttng_domain_type domain);
enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
- char *filter_expression,
- struct lttng_bytecode *filter,
- struct lttng_event_exclusion *exclusion,
- bool internal_event, struct ltt_ust_event **ust_event);
-struct ltt_ust_context *trace_ust_create_context(
- const struct lttng_event_context *ctx);
+ char *filter_expression,
+ struct lttng_bytecode *filter,
+ struct lttng_event_exclusion *exclusion,
+ bool internal_event,
+ struct ltt_ust_event **ust_event);
+struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_context *ctx);
int trace_ust_match_context(const struct ltt_ust_context *uctx,
- const struct lttng_event_context *ctx);
-void trace_ust_delete_channel(struct lttng_ht *ht,
- struct ltt_ust_channel *channel);
+ const struct lttng_event_context *ctx);
+void trace_ust_delete_channel(struct lttng_ht *ht, struct ltt_ust_channel *channel);
int trace_ust_regenerate_metadata(struct ltt_ust_session *usess);
void trace_ust_free_session(struct ltt_ust_session *session);
int trace_ust_id_tracker_lookup(enum lttng_process_attr process_attr,
- struct ltt_ust_session *session,
- int id);
-enum lttng_error_code trace_ust_process_attr_tracker_set_tracking_policy(
- struct ltt_ust_session *session,
- enum lttng_process_attr process_attr,
- enum lttng_tracking_policy policy);
-enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
- struct ltt_ust_session *session,
- enum lttng_process_attr process_attr,
- const struct process_attr_value *value);
-enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
- struct ltt_ust_session *session,
- enum lttng_process_attr process_attr,
- const struct process_attr_value *value);
-const struct process_attr_tracker *trace_ust_get_process_attr_tracker(
- struct ltt_ust_session *session,
- enum lttng_process_attr process_attr);
+ struct ltt_ust_session *session,
+ int id);
+enum lttng_error_code
+trace_ust_process_attr_tracker_set_tracking_policy(struct ltt_ust_session *session,
+ enum lttng_process_attr process_attr,
+ enum lttng_tracking_policy policy);
+enum lttng_error_code
+trace_ust_process_attr_tracker_inclusion_set_add_value(struct ltt_ust_session *session,
+ enum lttng_process_attr process_attr,
+ const struct process_attr_value *value);
+enum lttng_error_code
+trace_ust_process_attr_tracker_inclusion_set_remove_value(struct ltt_ust_session *session,
+ enum lttng_process_attr process_attr,
+ const struct process_attr_value *value);
+const struct process_attr_tracker *
+trace_ust_get_process_attr_tracker(struct ltt_ust_session *session,
+ enum lttng_process_attr process_attr);
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline int trace_ust_ht_match_event(
- struct cds_lfht_node *node __attribute__((unused)),
- const void *_key __attribute__((unused)))
+static inline int trace_ust_ht_match_event(struct cds_lfht_node *node __attribute__((unused)),
+ const void *_key __attribute__((unused)))
{
return 0;
}
-static inline int trace_ust_ht_match_event_by_name(
- struct cds_lfht_node *node __attribute__((unused)),
- const void *_key __attribute__((unused)))
+static inline int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node
+ __attribute__((unused)),
+ const void *_key __attribute__((unused)))
{
return 0;
}
-static inline
-struct ltt_ust_channel *trace_ust_find_channel_by_name(
- struct lttng_ht *ht __attribute__((unused)),
- const char *name __attribute__((unused)))
+static inline struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht
+ __attribute__((unused)),
+ const char *name
+ __attribute__((unused)))
{
return NULL;
}
-static inline
-struct ltt_ust_session *trace_ust_create_session(
- unsigned int session_id __attribute__((unused)))
+static inline struct ltt_ust_session *trace_ust_create_session(unsigned int session_id
+ __attribute__((unused)))
{
return NULL;
}
-static inline
-struct ltt_ust_channel *trace_ust_create_channel(
- struct lttng_channel *attr __attribute__((unused)),
- enum lttng_domain_type domain __attribute__((unused)))
+static inline struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr
+ __attribute__((unused)),
+ enum lttng_domain_type domain
+ __attribute__((unused)))
{
return NULL;
}
-static inline
-enum lttng_error_code trace_ust_create_event(
- struct lttng_event *ev __attribute__((unused)),
- const char *filter_expression __attribute__((unused)),
- struct lttng_bytecode *filter __attribute__((unused)),
- struct lttng_event_exclusion *exclusion __attribute__((unused)),
- bool internal_event __attribute__((unused)),
- struct ltt_ust_event **ust_event __attribute__((unused)))
+static inline enum lttng_error_code
+trace_ust_create_event(struct lttng_event *ev __attribute__((unused)),
+ const char *filter_expression __attribute__((unused)),
+ struct lttng_bytecode *filter __attribute__((unused)),
+ struct lttng_event_exclusion *exclusion __attribute__((unused)),
+ bool internal_event __attribute__((unused)),
+ struct ltt_ust_event **ust_event __attribute__((unused)))
{
return LTTNG_ERR_NO_UST;
}
-static inline
-void trace_ust_destroy_session(
- struct ltt_ust_session *session __attribute__((unused)))
+static inline void trace_ust_destroy_session(struct ltt_ust_session *session
+ __attribute__((unused)))
{
}
-static inline
-void trace_ust_destroy_channel(
- struct ltt_ust_channel *channel __attribute__((unused)))
+static inline void trace_ust_destroy_channel(struct ltt_ust_channel *channel
+ __attribute__((unused)))
{
}
-static inline
-void trace_ust_destroy_event(
- struct ltt_ust_event *event __attribute__((unused)))
+static inline void trace_ust_destroy_event(struct ltt_ust_event *event __attribute__((unused)))
{
}
-static inline
-void trace_ust_free_session(
- struct ltt_ust_session *session __attribute__((unused)))
+static inline void trace_ust_free_session(struct ltt_ust_session *session __attribute__((unused)))
{
}
-static inline
-struct ltt_ust_context *trace_ust_create_context(
- const struct lttng_event_context *ctx __attribute__((unused)))
+static inline struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_context *ctx
+ __attribute__((unused)))
{
return NULL;
}
-static inline
-int trace_ust_match_context(
- const struct ltt_ust_context *uctx __attribute__((unused)),
- const struct lttng_event_context *ctx __attribute__((unused)))
+static inline int trace_ust_match_context(const struct ltt_ust_context *uctx
+ __attribute__((unused)),
+ const struct lttng_event_context *ctx
+ __attribute__((unused)))
{
return 0;
}
-static inline
-struct ltt_ust_event *trace_ust_find_event(
- struct lttng_ht *ht __attribute__((unused)),
- char *name __attribute__((unused)),
- struct lttng_bytecode *filter __attribute__((unused)),
- enum lttng_ust_abi_loglevel_type loglevel_type __attribute__((unused)),
- int loglevel_value __attribute__((unused)),
- struct lttng_event_exclusion *exclusion __attribute__((unused)))
+static inline struct ltt_ust_event *
+trace_ust_find_event(struct lttng_ht *ht __attribute__((unused)),
+ char *name __attribute__((unused)),
+ struct lttng_bytecode *filter __attribute__((unused)),
+ enum lttng_ust_abi_loglevel_type loglevel_type __attribute__((unused)),
+ int loglevel_value __attribute__((unused)),
+ struct lttng_event_exclusion *exclusion __attribute__((unused)))
{
return NULL;
}
-static inline
-void trace_ust_delete_channel(
- struct lttng_ht *ht __attribute__((unused)),
- struct ltt_ust_channel *channel __attribute__((unused)))
+static inline void trace_ust_delete_channel(struct lttng_ht *ht __attribute__((unused)),
+ struct ltt_ust_channel *channel __attribute__((unused)))
{
return;
}
-static inline int trace_ust_regenerate_metadata(
- struct ltt_ust_session *usess __attribute__((unused)))
+static inline int trace_ust_regenerate_metadata(struct ltt_ust_session *usess
+ __attribute__((unused)))
{
return 0;
}
-static inline
-struct agent *trace_ust_find_agent(
- struct ltt_ust_session *session __attribute__((unused)),
- enum lttng_domain_type domain_type __attribute__((unused)))
+static inline struct agent *trace_ust_find_agent(struct ltt_ust_session *session
+ __attribute__((unused)),
+ enum lttng_domain_type domain_type
+ __attribute__((unused)))
{
return NULL;
}
-static inline int trace_ust_id_tracker_lookup(
- enum lttng_process_attr process_attr __attribute__((unused)),
- struct ltt_ust_session *session __attribute__((unused)),
- int id __attribute__((unused)))
+static inline int trace_ust_id_tracker_lookup(enum lttng_process_attr process_attr
+ __attribute__((unused)),
+ struct ltt_ust_session *session
+ __attribute__((unused)),
+ int id __attribute__((unused)))
{
return 0;
}
-static inline enum lttng_error_code
-trace_ust_process_attr_tracker_set_tracking_policy(
- struct ltt_ust_session *session __attribute__((unused)),
- enum lttng_process_attr process_attr __attribute__((unused)),
- enum lttng_tracking_policy policy __attribute__((unused)))
+static inline enum lttng_error_code trace_ust_process_attr_tracker_set_tracking_policy(
+ struct ltt_ust_session *session __attribute__((unused)),
+ enum lttng_process_attr process_attr __attribute__((unused)),
+ enum lttng_tracking_policy policy __attribute__((unused)))
{
return LTTNG_OK;
}
-static inline enum lttng_error_code
-trace_ust_process_attr_tracker_inclusion_set_add_value(
- struct ltt_ust_session *session __attribute__((unused)),
- enum lttng_process_attr process_attr __attribute__((unused)),
- const struct process_attr_value *value __attribute__((unused)))
+static inline enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
+ struct ltt_ust_session *session __attribute__((unused)),
+ enum lttng_process_attr process_attr __attribute__((unused)),
+ const struct process_attr_value *value __attribute__((unused)))
{
return LTTNG_OK;
}
-static inline enum lttng_error_code
-trace_ust_process_attr_tracker_inclusion_set_remove_value(
- struct ltt_ust_session *session __attribute__((unused)),
- enum lttng_process_attr process_attr __attribute__((unused)),
- const struct process_attr_value *value __attribute__((unused)))
+static inline enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
+ struct ltt_ust_session *session __attribute__((unused)),
+ enum lttng_process_attr process_attr __attribute__((unused)),
+ const struct process_attr_value *value __attribute__((unused)))
{
return LTTNG_OK;
}
static inline const struct process_attr_tracker *
-trace_ust_get_process_attr_tracker(
- struct ltt_ust_session *session __attribute__((unused)),
- enum lttng_process_attr process_attr __attribute__((unused)))
+trace_ust_get_process_attr_tracker(struct ltt_ust_session *session __attribute__((unused)),
+ enum lttng_process_attr process_attr __attribute__((unused)))
{
return NULL;
}
#define _LTT_TRACKER_H
#include <common/tracker.hpp>
+
#include <lttng/tracker.h>
struct process_attr_tracker;
struct process_attr_tracker *process_attr_tracker_create();
void process_attr_tracker_destroy(struct process_attr_tracker *tracker);
-enum lttng_tracking_policy process_attr_tracker_get_tracking_policy(
- const struct process_attr_tracker *tracker);
-int process_attr_tracker_set_tracking_policy(
- struct process_attr_tracker *tracker,
- enum lttng_tracking_policy tracking_policy);
+enum lttng_tracking_policy
+process_attr_tracker_get_tracking_policy(const struct process_attr_tracker *tracker);
+int process_attr_tracker_set_tracking_policy(struct process_attr_tracker *tracker,
+ enum lttng_tracking_policy tracking_policy);
-enum process_attr_tracker_status process_attr_tracker_inclusion_set_add_value(
- struct process_attr_tracker *tracker,
- const struct process_attr_value *value);
enum process_attr_tracker_status
-process_attr_tracker_inclusion_set_remove_value(
- struct process_attr_tracker *tracker,
- const struct process_attr_value *value);
+process_attr_tracker_inclusion_set_add_value(struct process_attr_tracker *tracker,
+ const struct process_attr_value *value);
+enum process_attr_tracker_status
+process_attr_tracker_inclusion_set_remove_value(struct process_attr_tracker *tracker,
+ const struct process_attr_value *value);
-enum process_attr_tracker_status process_attr_tracker_get_inclusion_set(
- const struct process_attr_tracker *tracker,
- struct lttng_process_attr_values **values);
+enum process_attr_tracker_status
+process_attr_tracker_get_inclusion_set(const struct process_attr_tracker *tracker,
+ struct lttng_process_attr_values **values);
#endif /* _LTT_TRACKER_H */
_trace_abi(abi),
_default_clock_class_name(in_default_clock_class_name ?
- in_default_clock_class_name->c_str() :
- nullptr),
+ in_default_clock_class_name->c_str() :
+ nullptr),
_type_overrides(type_overrides)
{
}
#ifndef LTTNG_TSDL_TRACE_CLASS_VISITOR_H
#define LTTNG_TSDL_TRACE_CLASS_VISITOR_H
-#include "trace-class.hpp"
-#include "stream-class.hpp"
#include "event-class.hpp"
+#include "stream-class.hpp"
+#include "trace-class.hpp"
#include <vendor/optional.hpp>
type_overrider() = default;
void publish(const lttng::sessiond::trace::type& original,
- lttng::sessiond::trace::type::cuptr new_type_override);
- const lttng::sessiond::trace::type& type(
- const lttng::sessiond::trace::type& original) const noexcept;
+ lttng::sessiond::trace::type::cuptr new_type_override);
+ const lttng::sessiond::trace::type&
+ type(const lttng::sessiond::trace::type& original) const noexcept;
private:
std::unordered_map<const lttng::sessiond::trace::type *, lttng::sessiond::trace::type::cuptr>
- _overriden_types;
+ _overriden_types;
};
} /* namespace details. */
class trace_class_visitor : public lttng::sessiond::trace::trace_class_visitor {
public:
trace_class_visitor(const lttng::sessiond::trace::abi& trace_abi,
- append_metadata_fragment_function append_metadata);
+ append_metadata_fragment_function append_metadata);
virtual void visit(const lttng::sessiond::trace::trace_class& trace_class) override final;
virtual void visit(const lttng::sessiond::trace::clock_class& clock_class) override final;
private:
/* Coherent (parseable) fragments must be appended. */
void append_metadata_fragment(const std::string& fragment) const;
- const lttng::sessiond::trace::type& _lookup_field_type(
- const lttng::sessiond::trace::field_location& field_location) const;
+ const lttng::sessiond::trace::type&
+ _lookup_field_type(const lttng::sessiond::trace::field_location& field_location) const;
const lttng::sessiond::trace::abi& _trace_abi;
const append_metadata_fragment_function _append_metadata_fragment;
#ifndef LTTNG_UST_ABI_INTERNAL_H
#define LTTNG_UST_ABI_INTERNAL_H
-#include <stdint.h>
#include <common/macros.hpp>
+#include <stdint.h>
+
#ifndef LTTNG_PACKED
#error "LTTNG_PACKED should be defined"
#endif
#ifndef __ust_stringify
-#define __ust_stringify1(x) #x
-#define __ust_stringify(x) __ust_stringify1(x)
+#define __ust_stringify1(x) #x
+#define __ust_stringify(x) __ust_stringify1(x)
#endif /* __ust_stringify */
-#define LTTNG_UST_ABI_SYM_NAME_LEN 256
-#define LTTNG_UST_ABI_PROCNAME_LEN 16
+#define LTTNG_UST_ABI_SYM_NAME_LEN 256
+#define LTTNG_UST_ABI_PROCNAME_LEN 16
/* UST comm magic number, used to validate protocol and endianness. */
-#define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5
+#define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5
/* Version for ABI between liblttng-ust, sessiond, consumerd */
-#define LTTNG_UST_ABI_MAJOR_VERSION 9
-#define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8
-#define LTTNG_UST_ABI_MINOR_VERSION 0
+#define LTTNG_UST_ABI_MAJOR_VERSION 9
+#define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8
+#define LTTNG_UST_ABI_MINOR_VERSION 0
enum lttng_ust_abi_instrumentation {
- LTTNG_UST_ABI_TRACEPOINT = 0,
- LTTNG_UST_ABI_PROBE = 1,
- LTTNG_UST_ABI_FUNCTION = 2,
+ LTTNG_UST_ABI_TRACEPOINT = 0,
+ LTTNG_UST_ABI_PROBE = 1,
+ LTTNG_UST_ABI_FUNCTION = 2,
};
enum lttng_ust_abi_loglevel_type {
- LTTNG_UST_ABI_LOGLEVEL_ALL = 0,
- LTTNG_UST_ABI_LOGLEVEL_RANGE = 1,
- LTTNG_UST_ABI_LOGLEVEL_SINGLE = 2,
+ LTTNG_UST_ABI_LOGLEVEL_ALL = 0,
+ LTTNG_UST_ABI_LOGLEVEL_RANGE = 1,
+ LTTNG_UST_ABI_LOGLEVEL_SINGLE = 2,
};
enum lttng_ust_abi_output {
- LTTNG_UST_ABI_MMAP = 0,
+ LTTNG_UST_ABI_MMAP = 0,
};
enum lttng_ust_abi_chan_type {
uint32_t patchlevel;
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_CHANNEL_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_CHANNEL_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
/*
* Given that the consumerd is limited to 64k file descriptors, we
* cannot expect much more than 1MB channel structure size. This size is
* depends on the number of streams within a channel, which depends on
* the number of possible CPUs on the system.
*/
-#define LTTNG_UST_ABI_CHANNEL_DATA_MAX_LEN 1048576U
+#define LTTNG_UST_ABI_CHANNEL_DATA_MAX_LEN 1048576U
struct lttng_ust_abi_channel {
uint64_t len;
- int32_t type; /* enum lttng_ust_abi_chan_type */
+ int32_t type; /* enum lttng_ust_abi_chan_type */
char padding[LTTNG_UST_ABI_CHANNEL_PADDING];
- char data[]; /* variable sized data */
+ char data[]; /* variable sized data */
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_STREAM_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_STREAM_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_stream {
- uint64_t len; /* shm len */
- uint32_t stream_nr; /* stream number */
+ uint64_t len; /* shm len */
+ uint32_t stream_nr; /* stream number */
char padding[LTTNG_UST_ABI_STREAM_PADDING1];
/*
* shm_fd and wakeup_fd are send over unix socket as file
#define LTTNG_UST_ABI_COUNTER_CONF_PADDING1 67
struct lttng_ust_abi_counter_conf {
- uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */
- uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */
+ uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */
+ uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */
uint32_t number_dimensions;
int64_t global_sum_step;
struct lttng_ust_abi_counter_dimension dimensions[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
int64_t value;
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_EVENT_PADDING1 8
-#define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_EVENT_PADDING1 8
+#define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_event {
- int32_t instrumentation; /* enum lttng_ust_abi_instrumentation */
- char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* event name */
+ int32_t instrumentation; /* enum lttng_ust_abi_instrumentation */
+ char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* event name */
- int32_t loglevel_type; /* enum lttng_ust_abi_loglevel_type */
- int32_t loglevel; /* value, -1: all */
- uint64_t token; /* User-provided token */
+ int32_t loglevel_type; /* enum lttng_ust_abi_loglevel_type */
+ int32_t loglevel; /* value, -1: all */
+ uint64_t token; /* User-provided token */
char padding[LTTNG_UST_ABI_EVENT_PADDING1];
/* Per instrumentation type configuration */
} u;
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING 32
+#define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING 32
struct lttng_ust_abi_event_notifier {
struct lttng_ust_abi_event event;
uint64_t error_counter_index;
char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING];
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
-#define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U
+#define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U
struct lttng_ust_abi_counter {
uint64_t len;
char padding[LTTNG_UST_ABI_COUNTER_PADDING1];
- char data[]; /* variable sized data */
+ char data[]; /* variable sized data */
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_counter_global {
- uint64_t len; /* shm len */
+ uint64_t len; /* shm len */
char padding[LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1];
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_counter_cpu {
- uint64_t len; /* shm len */
+ uint64_t len; /* shm len */
uint32_t cpu_nr;
char padding[LTTNG_UST_ABI_COUNTER_CPU_PADDING1];
} LTTNG_PACKED;
enum lttng_ust_abi_field_type {
- LTTNG_UST_ABI_FIELD_OTHER = 0,
- LTTNG_UST_ABI_FIELD_INTEGER = 1,
- LTTNG_UST_ABI_FIELD_ENUM = 2,
- LTTNG_UST_ABI_FIELD_FLOAT = 3,
- LTTNG_UST_ABI_FIELD_STRING = 4,
+ LTTNG_UST_ABI_FIELD_OTHER = 0,
+ LTTNG_UST_ABI_FIELD_INTEGER = 1,
+ LTTNG_UST_ABI_FIELD_ENUM = 2,
+ LTTNG_UST_ABI_FIELD_FLOAT = 3,
+ LTTNG_UST_ABI_FIELD_STRING = 4,
};
-#define LTTNG_UST_ABI_FIELD_ITER_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 28)
+#define LTTNG_UST_ABI_FIELD_ITER_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 28)
struct lttng_ust_abi_field_iter {
char event_name[LTTNG_UST_ABI_SYM_NAME_LEN];
char field_name[LTTNG_UST_ABI_SYM_NAME_LEN];
- int32_t type; /* enum lttng_ust_abi_field_type */
- int loglevel; /* event loglevel */
+ int32_t type; /* enum lttng_ust_abi_field_type */
+ int loglevel; /* event loglevel */
int nowrite;
char padding[LTTNG_UST_ABI_FIELD_ITER_PADDING];
} LTTNG_PACKED;
enum lttng_ust_abi_context_type {
- LTTNG_UST_ABI_CONTEXT_VTID = 0,
- LTTNG_UST_ABI_CONTEXT_VPID = 1,
- LTTNG_UST_ABI_CONTEXT_PTHREAD_ID = 2,
- LTTNG_UST_ABI_CONTEXT_PROCNAME = 3,
- LTTNG_UST_ABI_CONTEXT_IP = 4,
- LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER = 5,
- LTTNG_UST_ABI_CONTEXT_CPU_ID = 6,
- LTTNG_UST_ABI_CONTEXT_APP_CONTEXT = 7,
- LTTNG_UST_ABI_CONTEXT_CGROUP_NS = 8,
- LTTNG_UST_ABI_CONTEXT_IPC_NS = 9,
- LTTNG_UST_ABI_CONTEXT_MNT_NS = 10,
- LTTNG_UST_ABI_CONTEXT_NET_NS = 11,
- LTTNG_UST_ABI_CONTEXT_PID_NS = 12,
- LTTNG_UST_ABI_CONTEXT_USER_NS = 13,
- LTTNG_UST_ABI_CONTEXT_UTS_NS = 14,
- LTTNG_UST_ABI_CONTEXT_VUID = 15,
- LTTNG_UST_ABI_CONTEXT_VEUID = 16,
- LTTNG_UST_ABI_CONTEXT_VSUID = 17,
- LTTNG_UST_ABI_CONTEXT_VGID = 18,
- LTTNG_UST_ABI_CONTEXT_VEGID = 19,
- LTTNG_UST_ABI_CONTEXT_VSGID = 20,
- LTTNG_UST_ABI_CONTEXT_TIME_NS = 21,
+ LTTNG_UST_ABI_CONTEXT_VTID = 0,
+ LTTNG_UST_ABI_CONTEXT_VPID = 1,
+ LTTNG_UST_ABI_CONTEXT_PTHREAD_ID = 2,
+ LTTNG_UST_ABI_CONTEXT_PROCNAME = 3,
+ LTTNG_UST_ABI_CONTEXT_IP = 4,
+ LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER = 5,
+ LTTNG_UST_ABI_CONTEXT_CPU_ID = 6,
+ LTTNG_UST_ABI_CONTEXT_APP_CONTEXT = 7,
+ LTTNG_UST_ABI_CONTEXT_CGROUP_NS = 8,
+ LTTNG_UST_ABI_CONTEXT_IPC_NS = 9,
+ LTTNG_UST_ABI_CONTEXT_MNT_NS = 10,
+ LTTNG_UST_ABI_CONTEXT_NET_NS = 11,
+ LTTNG_UST_ABI_CONTEXT_PID_NS = 12,
+ LTTNG_UST_ABI_CONTEXT_USER_NS = 13,
+ LTTNG_UST_ABI_CONTEXT_UTS_NS = 14,
+ LTTNG_UST_ABI_CONTEXT_VUID = 15,
+ LTTNG_UST_ABI_CONTEXT_VEUID = 16,
+ LTTNG_UST_ABI_CONTEXT_VSUID = 17,
+ LTTNG_UST_ABI_CONTEXT_VGID = 18,
+ LTTNG_UST_ABI_CONTEXT_VEGID = 19,
+ LTTNG_UST_ABI_CONTEXT_VSGID = 20,
+ LTTNG_UST_ABI_CONTEXT_TIME_NS = 21,
};
struct lttng_ust_abi_perf_counter_ctx {
char name[LTTNG_UST_ABI_SYM_NAME_LEN];
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_CONTEXT_PADDING1 16
-#define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_CONTEXT_PADDING1 16
+#define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_context {
- int32_t ctx; /* enum lttng_ust_abi_context_type */
+ int32_t ctx; /* enum lttng_ust_abi_context_type */
char padding[LTTNG_UST_ABI_CONTEXT_PADDING1];
union {
/*
* Tracer channel attributes.
*/
-#define LTTNG_UST_ABI_CHANNEL_ATTR_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_CHANNEL_ATTR_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_channel_attr {
- uint64_t subbuf_size; /* bytes */
- uint64_t num_subbuf; /* power of 2 */
- int overwrite; /* 1: overwrite, 0: discard */
- unsigned int switch_timer_interval; /* usec */
- unsigned int read_timer_interval; /* usec */
- int32_t output; /* enum lttng_ust_abi_output */
+ uint64_t subbuf_size; /* bytes */
+ uint64_t num_subbuf; /* power of 2 */
+ int overwrite; /* 1: overwrite, 0: discard */
+ unsigned int switch_timer_interval; /* usec */
+ unsigned int read_timer_interval; /* usec */
+ int32_t output; /* enum lttng_ust_abi_output */
union {
struct {
- int64_t blocking_timeout; /* Blocking timeout (usec) */
+ int64_t blocking_timeout; /* Blocking timeout (usec) */
} s;
char padding[LTTNG_UST_ABI_CHANNEL_ATTR_PADDING];
} u;
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING 16
+#define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING 16
struct lttng_ust_abi_tracepoint_iter {
- char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* provider:name */
+ char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* provider:name */
int loglevel;
char padding[LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING];
} LTTNG_PACKED;
LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_CPU = 8,
};
-#define LTTNG_UST_ABI_OBJECT_DATA_PADDING1 32
-#define LTTNG_UST_ABI_OBJECT_DATA_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_OBJECT_DATA_PADDING1 32
+#define LTTNG_UST_ABI_OBJECT_DATA_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_object_data {
- int32_t type; /* enum lttng_ust_abi_object_type */
+ int32_t type; /* enum lttng_ust_abi_object_type */
int handle;
uint64_t size;
char padding1[LTTNG_UST_ABI_OBJECT_DATA_PADDING1];
union {
struct {
void *data;
- int32_t type; /* enum lttng_ust_abi_chan_type */
+ int32_t type; /* enum lttng_ust_abi_chan_type */
int wakeup_fd;
} channel;
struct {
LTTNG_UST_ABI_CALIBRATE_TRACEPOINT,
};
-#define LTTNG_UST_ABI_CALIBRATE_PADDING1 16
-#define LTTNG_UST_ABI_CALIBRATE_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
+#define LTTNG_UST_ABI_CALIBRATE_PADDING1 16
+#define LTTNG_UST_ABI_CALIBRATE_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_calibrate {
- enum lttng_ust_abi_calibrate_type type; /* type (input) */
+ enum lttng_ust_abi_calibrate_type type; /* type (input) */
char padding[LTTNG_UST_ABI_CALIBRATE_PADDING1];
union {
} u;
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN 65536
-#define LTTNG_UST_ABI_FILTER_PADDING 32
+#define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN 65536
+#define LTTNG_UST_ABI_FILTER_PADDING 32
struct lttng_ust_abi_filter_bytecode {
uint32_t len;
uint32_t reloc_offset;
char data[0];
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
-#define LTTNG_UST_ABI_CAPTURE_PADDING 32
+#define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
+#define LTTNG_UST_ABI_CAPTURE_PADDING 32
struct lttng_ust_abi_capture_bytecode {
uint32_t len;
uint32_t reloc_offset;
char data[0];
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_EXCLUSION_PADDING 32
+#define LTTNG_UST_ABI_EXCLUSION_PADDING 32
struct lttng_ust_abi_event_exclusion {
uint32_t count;
char padding[LTTNG_UST_ABI_EXCLUSION_PADDING];
char names[LTTNG_UST_ABI_SYM_NAME_LEN][0];
} LTTNG_PACKED;
-#define LTTNG_UST_ABI_CMD(minor) (minor)
-#define LTTNG_UST_ABI_CMDR(minor, type) (minor)
-#define LTTNG_UST_ABI_CMDW(minor, type) (minor)
+#define LTTNG_UST_ABI_CMD(minor) (minor)
+#define LTTNG_UST_ABI_CMDR(minor, type) (minor)
+#define LTTNG_UST_ABI_CMDW(minor, type) (minor)
/* Handled by object descriptor */
-#define LTTNG_UST_ABI_RELEASE LTTNG_UST_ABI_CMD(0x1)
+#define LTTNG_UST_ABI_RELEASE LTTNG_UST_ABI_CMD(0x1)
/* Handled by object cmd */
/* LTTng-UST commands */
-#define LTTNG_UST_ABI_SESSION LTTNG_UST_ABI_CMD(0x40)
-#define LTTNG_UST_ABI_TRACER_VERSION \
- LTTNG_UST_ABI_CMDR(0x41, struct lttng_ust_abi_tracer_version)
-#define LTTNG_UST_ABI_TRACEPOINT_LIST LTTNG_UST_ABI_CMD(0x42)
-#define LTTNG_UST_ABI_WAIT_QUIESCENT LTTNG_UST_ABI_CMD(0x43)
-#define LTTNG_UST_ABI_REGISTER_DONE LTTNG_UST_ABI_CMD(0x44)
-#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST LTTNG_UST_ABI_CMD(0x45)
-#define LTTNG_UST_ABI_EVENT_NOTIFIER_GROUP_CREATE \
- LTTNG_UST_ABI_CMD(0x46)
+#define LTTNG_UST_ABI_SESSION LTTNG_UST_ABI_CMD(0x40)
+#define LTTNG_UST_ABI_TRACER_VERSION LTTNG_UST_ABI_CMDR(0x41, struct lttng_ust_abi_tracer_version)
+#define LTTNG_UST_ABI_TRACEPOINT_LIST LTTNG_UST_ABI_CMD(0x42)
+#define LTTNG_UST_ABI_WAIT_QUIESCENT LTTNG_UST_ABI_CMD(0x43)
+#define LTTNG_UST_ABI_REGISTER_DONE LTTNG_UST_ABI_CMD(0x44)
+#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST LTTNG_UST_ABI_CMD(0x45)
+#define LTTNG_UST_ABI_EVENT_NOTIFIER_GROUP_CREATE LTTNG_UST_ABI_CMD(0x46)
/* Session commands */
-#define LTTNG_UST_ABI_CHANNEL \
- LTTNG_UST_ABI_CMDW(0x51, struct lttng_ust_abi_channel)
-#define LTTNG_UST_ABI_SESSION_START LTTNG_UST_ABI_CMD(0x52)
-#define LTTNG_UST_ABI_SESSION_STOP LTTNG_UST_ABI_CMD(0x53)
-#define LTTNG_UST_ABI_SESSION_STATEDUMP LTTNG_UST_ABI_CMD(0x54)
+#define LTTNG_UST_ABI_CHANNEL LTTNG_UST_ABI_CMDW(0x51, struct lttng_ust_abi_channel)
+#define LTTNG_UST_ABI_SESSION_START LTTNG_UST_ABI_CMD(0x52)
+#define LTTNG_UST_ABI_SESSION_STOP LTTNG_UST_ABI_CMD(0x53)
+#define LTTNG_UST_ABI_SESSION_STATEDUMP LTTNG_UST_ABI_CMD(0x54)
/* Channel commands */
-#define LTTNG_UST_ABI_STREAM LTTNG_UST_ABI_CMD(0x60)
-#define LTTNG_UST_ABI_EVENT \
- LTTNG_UST_ABI_CMDW(0x61, struct lttng_ust_abi_event)
+#define LTTNG_UST_ABI_STREAM LTTNG_UST_ABI_CMD(0x60)
+#define LTTNG_UST_ABI_EVENT LTTNG_UST_ABI_CMDW(0x61, struct lttng_ust_abi_event)
/* Event and channel commands */
-#define LTTNG_UST_ABI_CONTEXT \
- LTTNG_UST_ABI_CMDW(0x70, struct lttng_ust_abi_context)
-#define LTTNG_UST_ABI_FLUSH_BUFFER \
- LTTNG_UST_ABI_CMD(0x71)
+#define LTTNG_UST_ABI_CONTEXT LTTNG_UST_ABI_CMDW(0x70, struct lttng_ust_abi_context)
+#define LTTNG_UST_ABI_FLUSH_BUFFER LTTNG_UST_ABI_CMD(0x71)
/* Event, event notifier, channel and session commands */
-#define LTTNG_UST_ABI_ENABLE LTTNG_UST_ABI_CMD(0x80)
-#define LTTNG_UST_ABI_DISABLE LTTNG_UST_ABI_CMD(0x81)
+#define LTTNG_UST_ABI_ENABLE LTTNG_UST_ABI_CMD(0x80)
+#define LTTNG_UST_ABI_DISABLE LTTNG_UST_ABI_CMD(0x81)
/* Tracepoint list commands */
#define LTTNG_UST_ABI_TRACEPOINT_LIST_GET LTTNG_UST_ABI_CMD(0x90)
-#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST_GET LTTNG_UST_ABI_CMD(0x91)
+#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST_GET LTTNG_UST_ABI_CMD(0x91)
/* Event and event notifier commands */
-#define LTTNG_UST_ABI_FILTER LTTNG_UST_ABI_CMD(0xA0)
-#define LTTNG_UST_ABI_EXCLUSION LTTNG_UST_ABI_CMD(0xA1)
+#define LTTNG_UST_ABI_FILTER LTTNG_UST_ABI_CMD(0xA0)
+#define LTTNG_UST_ABI_EXCLUSION LTTNG_UST_ABI_CMD(0xA1)
/* Event notifier group commands */
-#define LTTNG_UST_ABI_EVENT_NOTIFIER_CREATE \
+#define LTTNG_UST_ABI_EVENT_NOTIFIER_CREATE \
LTTNG_UST_ABI_CMDW(0xB0, struct lttng_ust_abi_event_notifier)
/* Event notifier commands */
-#define LTTNG_UST_ABI_CAPTURE LTTNG_UST_ABI_CMD(0xB6)
+#define LTTNG_UST_ABI_CAPTURE LTTNG_UST_ABI_CMD(0xB6)
/* Session and event notifier group commands */
-#define LTTNG_UST_ABI_COUNTER \
- LTTNG_UST_ABI_CMDW(0xC0, struct lttng_ust_abi_counter)
+#define LTTNG_UST_ABI_COUNTER LTTNG_UST_ABI_CMDW(0xC0, struct lttng_ust_abi_counter)
/* Counter commands */
-#define LTTNG_UST_ABI_COUNTER_GLOBAL \
- LTTNG_UST_ABI_CMDW(0xD0, struct lttng_ust_abi_counter_global)
-#define LTTNG_UST_ABI_COUNTER_CPU \
- LTTNG_UST_ABI_CMDW(0xD1, struct lttng_ust_abi_counter_cpu)
+#define LTTNG_UST_ABI_COUNTER_GLOBAL LTTNG_UST_ABI_CMDW(0xD0, struct lttng_ust_abi_counter_global)
+#define LTTNG_UST_ABI_COUNTER_CPU LTTNG_UST_ABI_CMDW(0xD1, struct lttng_ust_abi_counter_cpu)
-#define LTTNG_UST_ABI_ROOT_HANDLE 0
+#define LTTNG_UST_ABI_ROOT_HANDLE 0
#endif /* LTTNG_UST_ABI_INTERNAL_H */
#ifndef _LTT_UST_APP_H
#define _LTT_UST_APP_H
-#include <stdint.h>
+#include "session.hpp"
+#include "trace-ust.hpp"
+#include "ust-field-convert.hpp"
+#include "ust-registry-session.hpp"
+#include "ust-registry.hpp"
-#include <common/index-allocator.hpp>
#include <common/format.hpp>
+#include <common/index-allocator.hpp>
#include <common/uuid.hpp>
-#include "trace-ust.hpp"
-#include "ust-registry.hpp"
-#include "ust-registry-session.hpp"
-#include "session.hpp"
-#include "ust-field-convert.hpp"
+#include <stdint.h>
#define UST_APP_EVENT_LIST_SIZE 32
/* Process name (short). */
-#define UST_APP_PROCNAME_LEN 16
+#define UST_APP_PROCNAME_LEN 16
struct lttng_bytecode;
struct lttng_ust_filter_bytecode;
uint32_t uint32_t_alignment;
uint32_t uint64_t_alignment;
uint32_t long_alignment;
- int byte_order; /* BIG_ENDIAN or LITTLE_ENDIAN */
+ int byte_order; /* BIG_ENDIAN or LITTLE_ENDIAN */
char name[LTTNG_UST_ABI_PROCNAME_LEN];
};
bool enabled;
/* started: has the session been in started state at any time ? */
- bool started; /* allows detection of start vs restart. */
- int handle; /* used has unique identifier for app session */
+ bool started; /* allows detection of start vs restart. */
+ int handle; /* used has unique identifier for app session */
- bool deleted; /* Session deleted flag. Check with lock held. */
+ bool deleted; /* Session deleted flag. Check with lock held. */
/*
* Tracing session ID. Multiple ust app session can have the same tracing
* session id making this value NOT unique to the object.
*/
uint64_t tracing_id;
- uint64_t id; /* Unique session identifier */
+ uint64_t id; /* Unique session identifier */
struct lttng_ht *channels; /* Registered channels */
struct lttng_ht_node_u64 node;
/*
struct rcu_head rcu_head;
/* If the channel's streams have to be outputed or not. */
unsigned int output_traces;
- unsigned int live_timer_interval; /* usec */
+ unsigned int live_timer_interval; /* usec */
/* Metadata channel attributes. */
struct lttng_ust_ctl_consumer_channel_attr metadata_attr;
struct ust_app {
/* Traffic initiated from the session daemon to the application. */
int sock;
- pthread_mutex_t sock_lock; /* Protects sock protocol. */
+ pthread_mutex_t sock_lock; /* Protects sock protocol. */
/* Traffic initiated from the application to the session daemon. */
int notify_sock;
pid_t pid;
pid_t ppid;
- uid_t uid; /* User ID that owns the apps */
- gid_t gid; /* Group ID that owns the apps */
+ uid_t uid; /* User ID that owns the apps */
+ gid_t gid; /* Group ID that owns the apps */
/* App ABI. */
lttng::sessiond::trace::abi abi;
supported version of the session daemon, this flag is
set to 0 (NOT compatible) else 1. */
struct lttng_ust_abi_tracer_version version;
- uint32_t v_major; /* Version major number */
- uint32_t v_minor; /* Version minor number */
+ uint32_t v_major; /* Version major number */
+ uint32_t v_minor; /* Version minor number */
/* Extra for the NULL byte. */
char name[UST_APP_PROCNAME_LEN + 1];
/* Type of buffer this application uses. */
template <typename FormatContextType>
typename FormatContextType::iterator format(const ust_app& app, FormatContextType& ctx)
{
- return format_to(ctx.out(),
- "{{ procname = `{}`, ppid = {}, pid = {}, uid = {}, gid = {}, version = {}.{}, registration time = {} }}",
- app.name, app.ppid, app.pid, app.uid, app.gid, app.v_major,
- app.v_minor,
- lttng::utils::time_to_iso8601_str(app.registration_time));
+ return format_to(
+ ctx.out(),
+ "{{ procname = `{}`, ppid = {}, pid = {}, uid = {}, gid = {}, version = {}.{}, registration time = {} }}",
+ app.name,
+ app.ppid,
+ app.pid,
+ app.uid,
+ app.gid,
+ app.v_major,
+ app.v_minor,
+ lttng::utils::time_to_iso8601_str(app.registration_time));
}
};
} /* namespace fmt */
int ust_app_list_events(struct lttng_event **events);
int ust_app_list_event_fields(struct lttng_event_field **fields);
int ust_app_create_event_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
-int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan);
-int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan);
+ struct ltt_ust_channel *uchan,
+ struct ltt_ust_event *uevent);
+int ust_app_disable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan);
+int ust_app_enable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan);
int ust_app_enable_event_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
+ struct ltt_ust_channel *uchan,
+ struct ltt_ust_event *uevent);
int ust_app_disable_event_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
+ struct ltt_ust_channel *uchan,
+ struct ltt_ust_event *uevent);
int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx);
+ struct ltt_ust_channel *uchan,
+ struct ltt_ust_context *uctx);
void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app);
void ust_app_global_update_all(struct ltt_ust_session *usess);
void ust_app_global_update_event_notifier_rules(struct ust_app *app);
struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock);
void ust_app_notify_sock_unregister(int sock);
ssize_t ust_app_push_metadata(const lttng::sessiond::ust::registry_session::locked_ptr& registry,
- struct consumer_socket *socket,
- int send_zero_data);
+ struct consumer_socket *socket,
+ int send_zero_data);
void ust_app_destroy(struct ust_app *app);
-enum lttng_error_code ust_app_snapshot_record(
- const struct ltt_ust_session *usess,
- const struct consumer_output *output,
- uint64_t nb_packets_per_stream);
-uint64_t ust_app_get_size_one_more_packet_per_stream(
- const struct ltt_ust_session *usess, uint64_t cur_nr_packets);
+enum lttng_error_code ust_app_snapshot_record(const struct ltt_ust_session *usess,
+ const struct consumer_output *output,
+ uint64_t nb_packets_per_stream);
+uint64_t ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_session *usess,
+ uint64_t cur_nr_packets);
struct ust_app *ust_app_find_by_sock(int sock);
int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id,
- struct cds_list_head *buffer_reg_uid_list,
- struct consumer_output *consumer, uint64_t uchan_id,
- int overwrite, uint64_t *discarded, uint64_t *lost);
+ struct cds_list_head *buffer_reg_uid_list,
+ struct consumer_output *consumer,
+ uint64_t uchan_id,
+ int overwrite,
+ uint64_t *discarded,
+ uint64_t *lost);
int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan,
- struct consumer_output *consumer,
- int overwrite, uint64_t *discarded, uint64_t *lost);
+ struct ltt_ust_channel *uchan,
+ struct consumer_output *consumer,
+ int overwrite,
+ uint64_t *discarded,
+ uint64_t *lost);
int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess);
enum lttng_error_code ust_app_rotate_session(struct ltt_session *session);
-enum lttng_error_code ust_app_create_channel_subdirectories(
- const struct ltt_ust_session *session);
-int ust_app_release_object(struct ust_app *app,
- struct lttng_ust_abi_object_data *data);
+enum lttng_error_code ust_app_create_channel_subdirectories(const struct ltt_ust_session *session);
+int ust_app_release_object(struct ust_app *app, struct lttng_ust_abi_object_data *data);
enum lttng_error_code ust_app_clear_session(struct ltt_session *session);
enum lttng_error_code ust_app_open_packets(struct ltt_session *session);
int ust_app_setup_event_notifier_group(struct ust_app *app);
-static inline
-int ust_app_supported()
+static inline int ust_app_supported()
{
return 1;
}
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline
-int ust_app_destroy_trace_all(
- struct ltt_ust_session *usess __attribute__((unused)))
+static inline int ust_app_destroy_trace_all(struct ltt_ust_session *usess __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_start_trace(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ust_app *app __attribute__((unused)))
+static inline int ust_app_start_trace(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ust_app *app __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_start_trace_all(
- struct ltt_ust_session *usess __attribute__((unused)))
+static inline int ust_app_start_trace_all(struct ltt_ust_session *usess __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_stop_trace_all(
- struct ltt_ust_session *usess __attribute__((unused)))
+static inline int ust_app_stop_trace_all(struct ltt_ust_session *usess __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_list_events(
- struct lttng_event **events __attribute__((unused)))
+static inline int ust_app_list_events(struct lttng_event **events __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int ust_app_list_event_fields(
- struct lttng_event_field **fields __attribute__((unused)))
+static inline int ust_app_list_event_fields(struct lttng_event_field **fields
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int ust_app_register(
- struct ust_register_msg *msg __attribute__((unused)),
- int sock __attribute__((unused)))
+static inline int ust_app_register(struct ust_register_msg *msg __attribute__((unused)),
+ int sock __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int ust_app_register_done(struct ust_app *app __attribute__((unused)))
+static inline int ust_app_register_done(struct ust_app *app __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int ust_app_version(struct ust_app *app __attribute__((unused)))
+static inline int ust_app_version(struct ust_app *app __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-void ust_app_unregister(int sock __attribute__((unused)))
+static inline void ust_app_unregister(int sock __attribute__((unused)))
{
}
-static inline
-void ust_app_clean_list(void)
+static inline void ust_app_clean_list(void)
{
}
-static inline
-struct ust_app_list *ust_app_get_list(void)
+static inline struct ust_app_list *ust_app_get_list(void)
{
return NULL;
}
-static inline
-struct ust_app *ust_app_get_by_pid(pid_t pid __attribute__((unused)))
+static inline struct ust_app *ust_app_get_by_pid(pid_t pid __attribute__((unused)))
{
return NULL;
}
-static inline
-int ust_app_ht_alloc(void)
+static inline int ust_app_ht_alloc(void)
{
return 0;
}
-static inline
-void ust_app_global_update(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ust_app *app __attribute__((unused)))
-{}
+static inline void ust_app_global_update(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ust_app *app __attribute__((unused)))
+{
+}
-static inline
-void ust_app_global_update_event_notifier_rules(
- struct ust_app *app __attribute__((unused)))
-{}
+static inline void ust_app_global_update_event_notifier_rules(struct ust_app *app
+ __attribute__((unused)))
+{
+}
-static inline
-void ust_app_global_update_all_event_notifier_rules(void)
-{}
+static inline void ust_app_global_update_all_event_notifier_rules(void)
+{
+}
-static inline
-int ust_app_setup_event_notifier_group(
- struct ust_app *app __attribute__((unused)))
+static inline int ust_app_setup_event_notifier_group(struct ust_app *app __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_disable_channel_glb(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)))
+static inline int ust_app_disable_channel_glb(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_enable_channel_glb(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)))
+static inline int ust_app_enable_channel_glb(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_create_event_glb(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)),
- struct ltt_ust_event *uevent __attribute__((unused)))
+static inline int ust_app_create_event_glb(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)),
+ struct ltt_ust_event *uevent __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_disable_event_glb(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)),
- struct ltt_ust_event *uevent __attribute__((unused)))
+static inline int ust_app_disable_event_glb(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)),
+ struct ltt_ust_event *uevent __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_enable_event_glb(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)),
- struct ltt_ust_event *uevent __attribute__((unused)))
+static inline int ust_app_enable_event_glb(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)),
+ struct ltt_ust_event *uevent __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_add_ctx_channel_glb(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)),
- struct ltt_ust_context *uctx __attribute__((unused)))
+static inline int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)),
+ struct ltt_ust_context *uctx __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_enable_event_pid(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)),
- struct ltt_ust_event *uevent __attribute__((unused)),
- pid_t pid __attribute__((unused)))
+static inline int ust_app_enable_event_pid(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)),
+ struct ltt_ust_event *uevent __attribute__((unused)),
+ pid_t pid __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_recv_registration(
- int sock __attribute__((unused)),
- struct ust_register_msg *msg __attribute__((unused)))
+static inline int ust_app_recv_registration(int sock __attribute__((unused)),
+ struct ust_register_msg *msg __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_recv_notify(int sock __attribute__((unused)))
+static inline int ust_app_recv_notify(int sock __attribute__((unused)))
{
return 0;
}
-static inline
-struct ust_app *ust_app_create(
- struct ust_register_msg *msg __attribute__((unused)),
- int sock __attribute__((unused)))
+static inline struct ust_app *ust_app_create(struct ust_register_msg *msg __attribute__((unused)),
+ int sock __attribute__((unused)))
{
return NULL;
}
-static inline
-void ust_app_add(struct ust_app *app __attribute__((unused)))
+static inline void ust_app_add(struct ust_app *app __attribute__((unused)))
{
}
-static inline
-void ust_app_notify_sock_unregister(int sock __attribute__((unused)))
+static inline void ust_app_notify_sock_unregister(int sock __attribute__((unused)))
{
}
-static inline
-ssize_t ust_app_push_metadata(
- lttng::sessiond::ust::registry_session *registry __attribute__((unused)),
- struct consumer_socket *socket __attribute__((unused)),
- int send_zero_data __attribute__((unused)))
+static inline ssize_t ust_app_push_metadata(lttng::sessiond::ust::registry_session *registry
+ __attribute__((unused)),
+ struct consumer_socket *socket __attribute__((unused)),
+ int send_zero_data __attribute__((unused)))
{
return 0;
}
-static inline
-void ust_app_destroy(struct ust_app *app __attribute__((unused)))
+static inline void ust_app_destroy(struct ust_app *app __attribute__((unused)))
{
return;
}
-static inline
-enum lttng_error_code ust_app_snapshot_record(
- struct ltt_ust_session *usess __attribute__((unused)),
- const struct consumer_output *output __attribute__((unused)),
- uint64_t max_stream_size __attribute__((unused)))
+static inline enum lttng_error_code
+ust_app_snapshot_record(struct ltt_ust_session *usess __attribute__((unused)),
+ const struct consumer_output *output __attribute__((unused)),
+ uint64_t max_stream_size __attribute__((unused)))
{
return LTTNG_ERR_UNK;
}
-static inline
-unsigned int ust_app_get_nb_stream(
- struct ltt_ust_session *usess __attribute__((unused)))
+static inline unsigned int ust_app_get_nb_stream(struct ltt_ust_session *usess
+ __attribute__((unused)))
{
return 0;
}
-static inline
-void ust_app_update_event_notifier_error_count(
- struct lttng_trigger *lttng_trigger __attribute__((unused)))
+static inline void ust_app_update_event_notifier_error_count(struct lttng_trigger *lttng_trigger
+ __attribute__((unused)))
{
return;
}
-static inline
-int ust_app_supported(void)
+static inline int ust_app_supported(void)
{
return 0;
}
-static inline
-bool ust_app_supports_notifiers(
- const struct ust_app *app __attribute__((unused)))
+static inline bool ust_app_supports_notifiers(const struct ust_app *app __attribute__((unused)))
{
return false;
}
-static inline
-bool ust_app_supports_counters(
- const struct ust_app *app __attribute__((unused)))
+static inline bool ust_app_supports_counters(const struct ust_app *app __attribute__((unused)))
{
return false;
}
-static inline
-struct ust_app *ust_app_find_by_sock(int sock __attribute__((unused)))
+static inline struct ust_app *ust_app_find_by_sock(int sock __attribute__((unused)))
{
return NULL;
}
-static inline
-struct ust_app *ust_app_find_by_pid(pid_t pid __attribute__((unused)))
+static inline struct ust_app *ust_app_find_by_pid(pid_t pid __attribute__((unused)))
{
return NULL;
}
-static inline
-uint64_t ust_app_get_size_one_more_packet_per_stream(
- const struct ltt_ust_session *usess __attribute__((unused)),
- uint64_t cur_nr_packets __attribute__((unused))) {
+static inline uint64_t
+ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_session *usess
+ __attribute__((unused)),
+ uint64_t cur_nr_packets __attribute__((unused)))
+{
return 0;
}
-static inline
-int ust_app_uid_get_channel_runtime_stats(
- uint64_t ust_session_id __attribute__((unused)),
- struct cds_list_head *buffer_reg_uid_list __attribute__((unused)),
- struct consumer_output *consumer __attribute__((unused)),
- int overwrite __attribute__((unused)),
- uint64_t uchan_id __attribute__((unused)),
- uint64_t *discarded __attribute__((unused)),
- uint64_t *lost __attribute__((unused)))
+static inline int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id
+ __attribute__((unused)),
+ struct cds_list_head *buffer_reg_uid_list
+ __attribute__((unused)),
+ struct consumer_output *consumer
+ __attribute__((unused)),
+ int overwrite __attribute__((unused)),
+ uint64_t uchan_id __attribute__((unused)),
+ uint64_t *discarded __attribute__((unused)),
+ uint64_t *lost __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_pid_get_channel_runtime_stats(
- struct ltt_ust_session *usess __attribute__((unused)),
- struct ltt_ust_channel *uchan __attribute__((unused)),
- struct consumer_output *consumer __attribute__((unused)),
- int overwrite __attribute__((unused)),
- uint64_t *discarded __attribute__((unused)),
- uint64_t *lost __attribute__((unused)))
+static inline int
+ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess __attribute__((unused)),
+ struct ltt_ust_channel *uchan __attribute__((unused)),
+ struct consumer_output *consumer __attribute__((unused)),
+ int overwrite __attribute__((unused)),
+ uint64_t *discarded __attribute__((unused)),
+ uint64_t *lost __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_app_regenerate_statedump_all(
- struct ltt_ust_session *usess __attribute__((unused)))
+static inline int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess
+ __attribute__((unused)))
{
return 0;
}
-static inline
-enum lttng_error_code ust_app_rotate_session(
- struct ltt_session *session __attribute__((unused)))
+static inline enum lttng_error_code ust_app_rotate_session(struct ltt_session *session
+ __attribute__((unused)))
{
return LTTNG_ERR_UNK;
}
-static inline
-enum lttng_error_code ust_app_create_channel_subdirectories(
- const struct ltt_ust_session *session __attribute__((unused)))
+static inline enum lttng_error_code
+ust_app_create_channel_subdirectories(const struct ltt_ust_session *session __attribute__((unused)))
{
return LTTNG_ERR_UNK;
}
-static inline
-int ust_app_release_object(struct ust_app *app __attribute__((unused)),
- struct lttng_ust_abi_object_data *data __attribute__((unused)))
+static inline int ust_app_release_object(struct ust_app *app __attribute__((unused)),
+ struct lttng_ust_abi_object_data *data
+ __attribute__((unused)))
{
return 0;
}
-static inline
-enum lttng_error_code ust_app_clear_session(
- struct ltt_session *session __attribute__((unused)))
+static inline enum lttng_error_code ust_app_clear_session(struct ltt_session *session
+ __attribute__((unused)))
{
return LTTNG_ERR_UNK;
}
-static inline
-enum lttng_error_code ust_app_open_packets(
- struct ltt_session *session __attribute__((unused)))
+static inline enum lttng_error_code ust_app_open_packets(struct ltt_session *session
+ __attribute__((unused)))
{
return LTTNG_ERR_UNK;
}
#include "consumer.hpp"
#include "ust-app.hpp"
-#include <stdint.h>
+
#include <common/trace-chunk.hpp>
+#include <stdint.h>
+
int ust_consumer_ask_channel(struct ust_app_session *ua_sess,
- struct ust_app_channel *ua_chan,
- struct consumer_output *consumer,
- struct consumer_socket *socket,
- lttng::sessiond::ust::registry_session *registry,
- struct lttng_trace_chunk *trace_chunk);
+ struct ust_app_channel *ua_chan,
+ struct consumer_output *consumer,
+ struct consumer_socket *socket,
+ lttng::sessiond::ust::registry_session *registry,
+ struct lttng_trace_chunk *trace_chunk);
-int ust_consumer_get_channel(struct consumer_socket *socket,
- struct ust_app_channel *ua_chan);
+int ust_consumer_get_channel(struct consumer_socket *socket, struct ust_app_channel *ua_chan);
-int ust_consumer_destroy_channel(struct consumer_socket *socket,
- struct ust_app_channel *ua_chan);
+int ust_consumer_destroy_channel(struct consumer_socket *socket, struct ust_app_channel *ua_chan);
int ust_consumer_send_stream_to_ust(struct ust_app *app,
- struct ust_app_channel *channel, struct ust_app_stream *stream);
+ struct ust_app_channel *channel,
+ struct ust_app_stream *stream);
int ust_consumer_send_channel_to_ust(struct ust_app *app,
- struct ust_app_session *ua_sess, struct ust_app_channel *channel);
+ struct ust_app_session *ua_sess,
+ struct ust_app_channel *channel);
#ifdef HAVE_LIBLTTNG_UST_CTL
int ust_consumer_metadata_request(struct consumer_socket *sock);
#else
-static inline
-int ust_consumer_metadata_request(
- struct consumer_socket *sock __attribute__((unused)))
+static inline int ust_consumer_metadata_request(struct consumer_socket *sock
+ __attribute__((unused)))
{
return -ENOSYS;
}
#ifndef LTTNG_UST_CTL_INTERNAL_H
#define LTTNG_UST_CTL_INTERNAL_H
-#include <sys/types.h>
-#include <limits.h>
-
#include "lttng-ust-abi.hpp"
+#include <limits.h>
+#include <sys/types.h>
+
#ifndef LTTNG_UST_UUID_LEN
-#define LTTNG_UST_UUID_LEN 16
+#define LTTNG_UST_UUID_LEN 16
#endif
/* Default unix socket path */
-#define LTTNG_UST_SOCK_FILENAME \
- "lttng-ust-sock-" \
- __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE)
+#define LTTNG_UST_SOCK_FILENAME \
+ "lttng-ust-sock-" __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE)
/*
* Shared memory files path are automatically related to shm root, e.g.
* /dev/shm under linux.
*/
-#define LTTNG_UST_WAIT_FILENAME \
- "lttng-ust-wait-" \
- __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE)
+#define LTTNG_UST_WAIT_FILENAME \
+ "lttng-ust-wait-" __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE)
struct lttng_ust_shm_handle;
struct lttng_ust_lib_ring_buffer;
struct lttng_ust_ctl_consumer_channel_attr {
enum lttng_ust_abi_chan_type type;
- uint64_t subbuf_size; /* bytes */
- uint64_t num_subbuf; /* power of 2 */
- int overwrite; /* 1: overwrite, 0: discard */
- unsigned int switch_timer_interval; /* usec */
- unsigned int read_timer_interval; /* usec */
- enum lttng_ust_abi_output output; /* splice, mmap */
- uint32_t chan_id; /* channel ID */
+ uint64_t subbuf_size; /* bytes */
+ uint64_t num_subbuf; /* power of 2 */
+ int overwrite; /* 1: overwrite, 0: discard */
+ unsigned int switch_timer_interval; /* usec */
+ unsigned int read_timer_interval; /* usec */
+ enum lttng_ust_abi_output output; /* splice, mmap */
+ uint32_t chan_id; /* channel ID */
unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
- int64_t blocking_timeout; /* Blocking timeout (usec) */
+ int64_t blocking_timeout; /* Blocking timeout (usec) */
} LTTNG_PACKED;
/*
*/
int lttng_ust_ctl_register_done(int sock);
int lttng_ust_ctl_create_session(int sock);
-int lttng_ust_ctl_create_event(int sock, struct lttng_ust_abi_event *ev,
- struct lttng_ust_abi_object_data *channel_data,
- struct lttng_ust_abi_object_data **event_data);
-int lttng_ust_ctl_add_context(int sock, struct lttng_ust_context_attr *ctx,
- struct lttng_ust_abi_object_data *obj_data,
- struct lttng_ust_abi_object_data **context_data);
-int lttng_ust_ctl_set_filter(int sock, struct lttng_ust_abi_filter_bytecode *bytecode,
- struct lttng_ust_abi_object_data *obj_data);
-int lttng_ust_ctl_set_capture(int sock, struct lttng_ust_abi_capture_bytecode *bytecode,
- struct lttng_ust_abi_object_data *obj_data);
-int lttng_ust_ctl_set_exclusion(int sock, struct lttng_ust_abi_event_exclusion *exclusion,
- struct lttng_ust_abi_object_data *obj_data);
+int lttng_ust_ctl_create_event(int sock,
+ struct lttng_ust_abi_event *ev,
+ struct lttng_ust_abi_object_data *channel_data,
+ struct lttng_ust_abi_object_data **event_data);
+int lttng_ust_ctl_add_context(int sock,
+ struct lttng_ust_context_attr *ctx,
+ struct lttng_ust_abi_object_data *obj_data,
+ struct lttng_ust_abi_object_data **context_data);
+int lttng_ust_ctl_set_filter(int sock,
+ struct lttng_ust_abi_filter_bytecode *bytecode,
+ struct lttng_ust_abi_object_data *obj_data);
+int lttng_ust_ctl_set_capture(int sock,
+ struct lttng_ust_abi_capture_bytecode *bytecode,
+ struct lttng_ust_abi_object_data *obj_data);
+int lttng_ust_ctl_set_exclusion(int sock,
+ struct lttng_ust_abi_event_exclusion *exclusion,
+ struct lttng_ust_abi_object_data *obj_data);
int lttng_ust_ctl_enable(int sock, struct lttng_ust_abi_object_data *object);
int lttng_ust_ctl_disable(int sock, struct lttng_ust_abi_object_data *object);
* of that group is fired. It returns a handle to be used when creating event
* notifier in that group.
*/
-int lttng_ust_ctl_create_event_notifier_group(int sock, int pipe_fd,
- struct lttng_ust_abi_object_data **event_notifier_group);
+int lttng_ust_ctl_create_event_notifier_group(
+ int sock, int pipe_fd, struct lttng_ust_abi_object_data **event_notifier_group);
/*
* lttng_ust_ctl_create_event notifier creates a event notifier in a event notifier
* notifier.
*/
int lttng_ust_ctl_create_event_notifier(int sock,
- struct lttng_ust_abi_event_notifier *event_notifier,
- struct lttng_ust_abi_object_data *event_notifier_group,
- struct lttng_ust_abi_object_data **event_notifier_data);
+ struct lttng_ust_abi_event_notifier *event_notifier,
+ struct lttng_ust_abi_object_data *event_notifier_group,
+ struct lttng_ust_abi_object_data **event_notifier_data);
/*
* lttng_ust_ctl_tracepoint_list returns a tracepoint list handle, or negative
* handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is
* returned.
*/
-int lttng_ust_ctl_tracepoint_list_get(int sock, int tp_list_handle,
- struct lttng_ust_abi_tracepoint_iter *iter);
+int lttng_ust_ctl_tracepoint_list_get(int sock,
+ int tp_list_handle,
+ struct lttng_ust_abi_tracepoint_iter *iter);
/*
* lttng_ust_ctl_tracepoint_field_list returns a tracepoint field list handle,
* list handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is
* returned.
*/
-int lttng_ust_ctl_tracepoint_field_list_get(int sock, int tp_field_list_handle,
- struct lttng_ust_abi_field_iter *iter);
+int lttng_ust_ctl_tracepoint_field_list_get(int sock,
+ int tp_field_list_handle,
+ struct lttng_ust_abi_field_iter *iter);
int lttng_ust_ctl_tracer_version(int sock, struct lttng_ust_abi_tracer_version *v);
int lttng_ust_ctl_wait_quiescent(int sock);
int lttng_ust_ctl_release_handle(int sock, int handle);
int lttng_ust_ctl_recv_channel_from_consumer(int sock,
- struct lttng_ust_abi_object_data **channel_data);
+ struct lttng_ust_abi_object_data **channel_data);
int lttng_ust_ctl_recv_stream_from_consumer(int sock,
- struct lttng_ust_abi_object_data **stream_data);
-int lttng_ust_ctl_send_channel_to_ust(int sock, int session_handle,
- struct lttng_ust_abi_object_data *channel_data);
+ struct lttng_ust_abi_object_data **stream_data);
+int lttng_ust_ctl_send_channel_to_ust(int sock,
+ int session_handle,
+ struct lttng_ust_abi_object_data *channel_data);
int lttng_ust_ctl_send_stream_to_ust(int sock,
- struct lttng_ust_abi_object_data *channel_data,
- struct lttng_ust_abi_object_data *stream_data);
+ struct lttng_ust_abi_object_data *channel_data,
+ struct lttng_ust_abi_object_data *stream_data);
/*
* lttng_ust_ctl_duplicate_ust_object_data allocated a new object in "dest" if
* lttng_ust_ctl_release_object() and then freed with free().
*/
int lttng_ust_ctl_duplicate_ust_object_data(struct lttng_ust_abi_object_data **dest,
- struct lttng_ust_abi_object_data *src);
+ struct lttng_ust_abi_object_data *src);
/*
* API used by consumer.
int lttng_ust_ctl_get_nr_stream_per_channel(void);
-struct lttng_ust_ctl_consumer_channel *
- lttng_ust_ctl_create_channel(struct lttng_ust_ctl_consumer_channel_attr *attr,
- const int *stream_fds, int nr_stream_fds);
+struct lttng_ust_ctl_consumer_channel *lttng_ust_ctl_create_channel(
+ struct lttng_ust_ctl_consumer_channel_attr *attr, const int *stream_fds, int nr_stream_fds);
/*
* Each stream created needs to be destroyed before calling
* lttng_ust_ctl_destroy_channel().
void lttng_ust_ctl_destroy_channel(struct lttng_ust_ctl_consumer_channel *chan);
int lttng_ust_ctl_send_channel_to_sessiond(int sock,
- struct lttng_ust_ctl_consumer_channel *channel);
+ struct lttng_ust_ctl_consumer_channel *channel);
int lttng_ust_ctl_channel_close_wait_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan);
int lttng_ust_ctl_channel_close_wakeup_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan);
int lttng_ust_ctl_channel_get_wait_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan);
int lttng_ust_ctl_channel_get_wakeup_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan);
-int lttng_ust_ctl_write_metadata_to_channel(
- struct lttng_ust_ctl_consumer_channel *channel,
- const char *metadata_str, /* NOT null-terminated */
- size_t len); /* metadata length */
-ssize_t lttng_ust_ctl_write_one_packet_to_channel(
- struct lttng_ust_ctl_consumer_channel *channel,
- const char *metadata_str, /* NOT null-terminated */
- size_t len); /* metadata length */
+int lttng_ust_ctl_write_metadata_to_channel(struct lttng_ust_ctl_consumer_channel *channel,
+ const char *metadata_str, /* NOT null-terminated */
+ size_t len); /* metadata length */
+ssize_t lttng_ust_ctl_write_one_packet_to_channel(struct lttng_ust_ctl_consumer_channel *channel,
+ const char *metadata_str, /* NOT null-terminated
+ */
+ size_t len); /* metadata length */
/*
* Send a NULL stream to finish iteration over all streams of a given
* channel.
*/
-int lttng_ust_ctl_send_stream_to_sessiond(int sock,
- struct lttng_ust_ctl_consumer_stream *stream);
+int lttng_ust_ctl_send_stream_to_sessiond(int sock, struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_stream_close_wait_fd(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_stream_close_wakeup_fd(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_stream_get_wait_fd(struct lttng_ust_ctl_consumer_stream *stream);
/* Create/destroy stream buffers for read */
struct lttng_ust_ctl_consumer_stream *
- lttng_ust_ctl_create_stream(struct lttng_ust_ctl_consumer_channel *channel,
- int cpu);
+lttng_ust_ctl_create_stream(struct lttng_ust_ctl_consumer_channel *channel, int cpu);
void lttng_ust_ctl_destroy_stream(struct lttng_ust_ctl_consumer_stream *stream);
/* For mmap mode, readable without "get" operation */
-int lttng_ust_ctl_get_mmap_len(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *len);
+int lttng_ust_ctl_get_mmap_len(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len);
int lttng_ust_ctl_get_max_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *len);
+ unsigned long *len);
/*
* For mmap mode, operate on the current packet (between get/put or
*/
void *lttng_ust_ctl_get_mmap_base(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_get_mmap_read_offset(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *off);
-int lttng_ust_ctl_get_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *len);
+ unsigned long *off);
+int lttng_ust_ctl_get_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len);
int lttng_ust_ctl_get_padded_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *len);
+ unsigned long *len);
int lttng_ust_ctl_get_next_subbuf(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_put_next_subbuf(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_snapshot(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_snapshot_sample_positions(struct lttng_ust_ctl_consumer_stream *stream);
int lttng_ust_ctl_snapshot_get_consumed(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *pos);
+ unsigned long *pos);
int lttng_ust_ctl_snapshot_get_produced(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *pos);
-int lttng_ust_ctl_get_subbuf(struct lttng_ust_ctl_consumer_stream *stream,
- unsigned long *pos);
+ unsigned long *pos);
+int lttng_ust_ctl_get_subbuf(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *pos);
int lttng_ust_ctl_put_subbuf(struct lttng_ust_ctl_consumer_stream *stream);
-int lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream,
- int producer_active);
+int lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream, int producer_active);
int lttng_ust_ctl_clear_buffer(struct lttng_ust_ctl_consumer_stream *stream);
/* index */
*/
int lttng_ust_ctl_get_timestamp_begin(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *timestamp_begin);
+ uint64_t *timestamp_begin);
int lttng_ust_ctl_get_timestamp_end(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *timestamp_end);
+ uint64_t *timestamp_end);
int lttng_ust_ctl_get_events_discarded(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *events_discarded);
+ uint64_t *events_discarded);
int lttng_ust_ctl_get_content_size(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *content_size);
+ uint64_t *content_size);
int lttng_ust_ctl_get_packet_size(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *packet_size);
-int lttng_ust_ctl_get_sequence_number(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *seq);
+ uint64_t *packet_size);
+int lttng_ust_ctl_get_sequence_number(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *seq);
/*
* Getter returning state invariant for the stream, which can be used
* without "get" operation.
*/
-int lttng_ust_ctl_get_stream_id(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *stream_id);
-int lttng_ust_ctl_get_instance_id(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *id);
+int lttng_ust_ctl_get_stream_id(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *stream_id);
+int lttng_ust_ctl_get_instance_id(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *id);
/*
* Getter returning the current timestamp as perceived from the
* tracer.
*/
-int lttng_ust_ctl_get_current_timestamp(struct lttng_ust_ctl_consumer_stream *stream,
- uint64_t *ts);
+int lttng_ust_ctl_get_current_timestamp(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *ts);
/* returns whether UST has perf counters support. */
int lttng_ust_ctl_has_perf_counters(void);
enum lttng_ust_ctl_abstract_types {
lttng_ust_ctl_atype_integer,
- lttng_ust_ctl_atype_enum, /* legacy */
- lttng_ust_ctl_atype_array, /* legacy */
- lttng_ust_ctl_atype_sequence, /* legacy */
+ lttng_ust_ctl_atype_enum, /* legacy */
+ lttng_ust_ctl_atype_array, /* legacy */
+ lttng_ust_ctl_atype_sequence, /* legacy */
lttng_ust_ctl_atype_string,
lttng_ust_ctl_atype_float,
- lttng_ust_ctl_atype_variant, /* legacy */
- lttng_ust_ctl_atype_struct, /* legacy */
+ lttng_ust_ctl_atype_variant, /* legacy */
+ lttng_ust_ctl_atype_struct, /* legacy */
lttng_ust_ctl_atype_enum_nestable,
lttng_ust_ctl_atype_array_nestable,
lttng_ust_ctl_atype_sequence_nestable,
NR_LTTNG_UST_CTL_STRING_ENCODINGS,
};
-#define LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING 24
+#define LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING 24
struct lttng_ust_ctl_integer_type {
- uint32_t size; /* in bits */
+ uint32_t size; /* in bits */
uint32_t signedness;
uint32_t reverse_byte_order;
- uint32_t base; /* 2, 8, 10, 16, for pretty print */
- int32_t encoding; /* enum lttng_ust_ctl_string_encodings */
- uint16_t alignment; /* in bits */
+ uint32_t base; /* 2, 8, 10, 16, for pretty print */
+ int32_t encoding; /* enum lttng_ust_ctl_string_encodings */
+ uint16_t alignment; /* in bits */
char padding[LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING];
} LTTNG_PACKED;
-#define LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING 24
+#define LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING 24
struct lttng_ust_ctl_float_type {
- uint32_t exp_dig; /* exponent digits, in bits */
- uint32_t mant_dig; /* mantissa digits, in bits */
+ uint32_t exp_dig; /* exponent digits, in bits */
+ uint32_t mant_dig; /* mantissa digits, in bits */
uint32_t reverse_byte_order;
- uint16_t alignment; /* in bits */
+ uint16_t alignment; /* in bits */
char padding[LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING];
} LTTNG_PACKED;
-#define LTTNG_UST_CTL_UST_ENUM_VALUE_PADDING 15
+#define LTTNG_UST_CTL_UST_ENUM_VALUE_PADDING 15
struct lttng_ust_ctl_enum_value {
uint64_t value;
uint8_t signedness;
LTTNG_UST_CTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
};
-#define LTTNG_UST_CTL_UST_ENUM_ENTRY_PADDING 32
+#define LTTNG_UST_CTL_UST_ENUM_ENTRY_PADDING 32
struct lttng_ust_ctl_enum_entry {
struct lttng_ust_ctl_enum_value start, end; /* start and end are inclusive */
char string[LTTNG_UST_ABI_SYM_NAME_LEN];
} LTTNG_PACKED;
/* legacy */
-#define LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING 296
+#define LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING 296
union _lttng_ust_ctl_basic_type {
struct lttng_ust_ctl_integer_type integer;
struct {
char name[LTTNG_UST_ABI_SYM_NAME_LEN];
struct lttng_ust_ctl_integer_type container_type;
- uint64_t id; /* enum ID in sessiond. */
+ uint64_t id; /* enum ID in sessiond. */
} enumeration;
struct {
- int32_t encoding; /* enum lttng_ust_ctl_string_encodings */
+ int32_t encoding; /* enum lttng_ust_ctl_string_encodings */
} string;
struct lttng_ust_ctl_float_type _float;
char padding[LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING];
* Padding is derived from largest member: u.legacy.sequence which
* contains two basic types, each with LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING.
*/
-#define LTTNG_UST_CTL_UST_TYPE_PADDING (2 * LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING)
+#define LTTNG_UST_CTL_UST_TYPE_PADDING (2 * LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING)
struct lttng_ust_ctl_type {
enum lttng_ust_ctl_abstract_types atype;
union {
struct lttng_ust_ctl_integer_type integer;
struct lttng_ust_ctl_float_type _float;
struct {
- int32_t encoding; /* enum lttng_ust_ctl_string_encodings */
+ int32_t encoding; /* enum lttng_ust_ctl_string_encodings */
} string;
struct {
char name[LTTNG_UST_ABI_SYM_NAME_LEN];
- uint64_t id; /* enum ID in sessiond. */
+ uint64_t id; /* enum ID in sessiond. */
/* container_type follows after this struct lttng_ust_ctl_field. */
} enum_nestable;
struct {
- uint32_t length; /* num. elems. */
+ uint32_t length; /* num. elems. */
uint32_t alignment;
/* elem_type follows after this struct lttng_ust_ctl_field. */
} array_nestable;
struct {
char length_name[LTTNG_UST_ABI_SYM_NAME_LEN];
- uint32_t alignment; /* Alignment before elements. */
+ uint32_t alignment; /* Alignment before elements. */
/* elem_type follows after the length_type. */
} sequence_nestable;
struct {
union _lttng_ust_ctl_basic_type basic;
struct {
struct lttng_ust_ctl_basic_type elem_type;
- uint32_t length; /* num. elems. */
+ uint32_t length; /* num. elems. */
} array;
struct {
struct lttng_ust_ctl_basic_type length_type;
} u;
} LTTNG_PACKED;
-#define LTTNG_UST_CTL_UST_FIELD_PADDING 28
+#define LTTNG_UST_CTL_UST_FIELD_PADDING 28
struct lttng_ust_ctl_field {
char name[LTTNG_UST_ABI_SYM_NAME_LEN];
struct lttng_ust_ctl_type type;
* the output fields are not populated.
*/
int lttng_ust_ctl_recv_reg_msg(int sock,
- enum lttng_ust_ctl_socket_type *type,
- uint32_t *major,
- uint32_t *minor,
- uint32_t *pid,
- uint32_t *ppid,
- uint32_t *uid,
- uint32_t *gid,
- uint32_t *bits_per_long,
- uint32_t *uint8_t_alignment,
- uint32_t *uint16_t_alignment,
- uint32_t *uint32_t_alignment,
- uint32_t *uint64_t_alignment,
- uint32_t *long_alignment,
- int *byte_order,
- char *name); /* size LTTNG_UST_ABI_PROCNAME_LEN */
+ enum lttng_ust_ctl_socket_type *type,
+ uint32_t *major,
+ uint32_t *minor,
+ uint32_t *pid,
+ uint32_t *ppid,
+ uint32_t *uid,
+ uint32_t *gid,
+ uint32_t *bits_per_long,
+ uint32_t *uint8_t_alignment,
+ uint32_t *uint16_t_alignment,
+ uint32_t *uint32_t_alignment,
+ uint32_t *uint64_t_alignment,
+ uint32_t *long_alignment,
+ int *byte_order,
+ char *name); /* size LTTNG_UST_ABI_PROCNAME_LEN */
/*
* Returns 0 on success, negative UST or system error value on error.
* Returns 0 on success, negative UST or system error value on error.
*/
int lttng_ust_ctl_recv_register_event(int sock,
- int *session_objd, /* session descriptor (output) */
- int *channel_objd, /* channel descriptor (output) */
- char *event_name, /*
- * event name (output,
- * size LTTNG_UST_ABI_SYM_NAME_LEN)
- */
- int *loglevel,
- char **signature, /*
- * event signature
- * (output, dynamically
- * allocated, must be free(3)'d
- * by the caller if function
- * returns success.)
- */
- size_t *nr_fields,
- struct lttng_ust_ctl_field **fields,
- char **model_emf_uri);
+ int *session_objd, /* session descriptor (output) */
+ int *channel_objd, /* channel descriptor (output) */
+ char *event_name, /*
+ * event name (output,
+ * size LTTNG_UST_ABI_SYM_NAME_LEN)
+ */
+ int *loglevel,
+ char **signature, /*
+ * event signature
+ * (output, dynamically
+ * allocated, must be free(3)'d
+ * by the caller if function
+ * returns success.)
+ */
+ size_t *nr_fields,
+ struct lttng_ust_ctl_field **fields,
+ char **model_emf_uri);
/*
* Returns 0 on success, negative error value on error.
*/
int lttng_ust_ctl_reply_register_event(int sock,
- uint32_t id, /* event id (input) */
- int ret_code); /* return code. 0 ok, negative error */
+ uint32_t id, /* event id (input) */
+ int ret_code); /* return code. 0 ok, negative error */
/*
* Returns 0 on success, negative UST or system error value on error.
*/
int lttng_ust_ctl_recv_register_enum(int sock,
- int *session_objd,
- char *enum_name,
- struct lttng_ust_ctl_enum_entry **entries,
- size_t *nr_entries);
+ int *session_objd,
+ char *enum_name,
+ struct lttng_ust_ctl_enum_entry **entries,
+ size_t *nr_entries);
/*
* Returns 0 on success, negative error value on error.
*/
int lttng_ust_ctl_reply_register_enum(int sock,
- uint64_t id, /* enum id (input) */
- int ret_code);
+ uint64_t id, /* enum id (input) */
+ int ret_code);
/*
* Returns 0 on success, negative UST or system error value on error.
*/
int lttng_ust_ctl_recv_register_channel(int sock,
- int *session_objd, /* session descriptor (output) */
- int *channel_objd, /* channel descriptor (output) */
- size_t *nr_fields, /* context fields */
- struct lttng_ust_ctl_field **fields);
+ int *session_objd, /* session descriptor (output) */
+ int *channel_objd, /* channel descriptor (output) */
+ size_t *nr_fields, /* context fields */
+ struct lttng_ust_ctl_field **fields);
/*
* Returns 0 on success, negative error value on error.
*/
int lttng_ust_ctl_reply_register_channel(int sock,
- uint32_t chan_id,
- enum lttng_ust_ctl_channel_header header_type,
- int ret_code); /* return code. 0 ok, negative error */
+ uint32_t chan_id,
+ enum lttng_ust_ctl_channel_header header_type,
+ int ret_code); /* return code. 0 ok, negative error */
/*
* Counter API.
};
enum lttng_ust_ctl_counter_arithmetic {
- LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR = 0,
- LTTNG_UST_CTL_COUNTER_ARITHMETIC_SATURATION = 1,
+ LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR = 0,
+ LTTNG_UST_CTL_COUNTER_ARITHMETIC_SATURATION = 1,
};
/* Used as alloc flags. */
};
struct lttng_ust_ctl_daemon_counter *
- lttng_ust_ctl_create_counter(size_t nr_dimensions,
- const struct lttng_ust_ctl_counter_dimension *dimensions,
- int64_t global_sum_step,
- int global_counter_fd,
- int nr_counter_cpu_fds,
- const int *counter_cpu_fds,
- enum lttng_ust_ctl_counter_bitness bitness,
- enum lttng_ust_ctl_counter_arithmetic arithmetic,
- uint32_t alloc_flags,
- bool coalesce_hits);
+lttng_ust_ctl_create_counter(size_t nr_dimensions,
+ const struct lttng_ust_ctl_counter_dimension *dimensions,
+ int64_t global_sum_step,
+ int global_counter_fd,
+ int nr_counter_cpu_fds,
+ const int *counter_cpu_fds,
+ enum lttng_ust_ctl_counter_bitness bitness,
+ enum lttng_ust_ctl_counter_arithmetic arithmetic,
+ uint32_t alloc_flags,
+ bool coalesce_hits);
int lttng_ust_ctl_create_counter_data(struct lttng_ust_ctl_daemon_counter *counter,
- struct lttng_ust_abi_object_data **counter_data);
+ struct lttng_ust_abi_object_data **counter_data);
int lttng_ust_ctl_create_counter_global_data(struct lttng_ust_ctl_daemon_counter *counter,
- struct lttng_ust_abi_object_data **counter_global_data);
-int lttng_ust_ctl_create_counter_cpu_data(struct lttng_ust_ctl_daemon_counter *counter, int cpu,
- struct lttng_ust_abi_object_data **counter_cpu_data);
+ struct lttng_ust_abi_object_data **counter_global_data);
+int lttng_ust_ctl_create_counter_cpu_data(struct lttng_ust_ctl_daemon_counter *counter,
+ int cpu,
+ struct lttng_ust_abi_object_data **counter_cpu_data);
/*
* Each counter data and counter cpu data created need to be destroyed
*/
void lttng_ust_ctl_destroy_counter(struct lttng_ust_ctl_daemon_counter *counter);
-int lttng_ust_ctl_send_counter_data_to_ust(int sock, int parent_handle,
- struct lttng_ust_abi_object_data *counter_data);
-int lttng_ust_ctl_send_counter_global_data_to_ust(int sock,
- struct lttng_ust_abi_object_data *counter_data,
- struct lttng_ust_abi_object_data *counter_global_data);
+int lttng_ust_ctl_send_counter_data_to_ust(int sock,
+ int parent_handle,
+ struct lttng_ust_abi_object_data *counter_data);
+int lttng_ust_ctl_send_counter_global_data_to_ust(
+ int sock,
+ struct lttng_ust_abi_object_data *counter_data,
+ struct lttng_ust_abi_object_data *counter_global_data);
int lttng_ust_ctl_send_counter_cpu_data_to_ust(int sock,
- struct lttng_ust_abi_object_data *counter_data,
- struct lttng_ust_abi_object_data *counter_cpu_data);
+ struct lttng_ust_abi_object_data *counter_data,
+ struct lttng_ust_abi_object_data *counter_cpu_data);
int lttng_ust_ctl_counter_read(struct lttng_ust_ctl_daemon_counter *counter,
- const size_t *dimension_indexes,
- int cpu, int64_t *value,
- bool *overflow, bool *underflow);
+ const size_t *dimension_indexes,
+ int cpu,
+ int64_t *value,
+ bool *overflow,
+ bool *underflow);
int lttng_ust_ctl_counter_aggregate(struct lttng_ust_ctl_daemon_counter *counter,
- const size_t *dimension_indexes,
- int64_t *value,
- bool *overflow, bool *underflow);
+ const size_t *dimension_indexes,
+ int64_t *value,
+ bool *overflow,
+ bool *underflow);
int lttng_ust_ctl_counter_clear(struct lttng_ust_ctl_daemon_counter *counter,
- const size_t *dimension_indexes);
+ const size_t *dimension_indexes);
void lttng_ust_ctl_sigbus_handle(void *addr);
* These declarations should NOT be considered stable API.
*/
+#include "lttng-ust-abi.hpp"
+
#include <limits.h>
#include <unistd.h>
-#include "lttng-ust-abi.hpp"
-
/*
* ustcomm error code.
*/
enum lttng_ust_error_code {
- LTTNG_UST_OK = 0, /* Ok */
- LTTNG_UST_ERR = 1024, /* Unknown Error */
- LTTNG_UST_ERR_NOENT = 1025, /* No entry */
- LTTNG_UST_ERR_EXIST = 1026, /* Object exists */
- LTTNG_UST_ERR_INVAL = 1027, /* Invalid argument */
- LTTNG_UST_ERR_PERM = 1028, /* Permission denied */
- LTTNG_UST_ERR_NOSYS = 1029, /* Not implemented */
- LTTNG_UST_ERR_EXITING = 1030, /* Process is exiting */
-
- LTTNG_UST_ERR_INVAL_MAGIC = 1031, /* Invalid magic number */
- LTTNG_UST_ERR_INVAL_SOCKET_TYPE = 1032, /* Invalid socket type */
- LTTNG_UST_ERR_UNSUP_MAJOR = 1033, /* Unsupported major version */
+ LTTNG_UST_OK = 0, /* Ok */
+ LTTNG_UST_ERR = 1024, /* Unknown Error */
+ LTTNG_UST_ERR_NOENT = 1025, /* No entry */
+ LTTNG_UST_ERR_EXIST = 1026, /* Object exists */
+ LTTNG_UST_ERR_INVAL = 1027, /* Invalid argument */
+ LTTNG_UST_ERR_PERM = 1028, /* Permission denied */
+ LTTNG_UST_ERR_NOSYS = 1029, /* Not implemented */
+ LTTNG_UST_ERR_EXITING = 1030, /* Process is exiting */
+
+ LTTNG_UST_ERR_INVAL_MAGIC = 1031, /* Invalid magic number */
+ LTTNG_UST_ERR_INVAL_SOCKET_TYPE = 1032, /* Invalid socket type */
+ LTTNG_UST_ERR_UNSUP_MAJOR = 1033, /* Unsupported major version */
/* MUST be last element */
- LTTNG_UST_ERR_NR, /* Last element */
+ LTTNG_UST_ERR_NR, /* Last element */
};
/*
*/
extern const char *lttng_ust_strerror(int code);
-#endif /* _LTTNG_UST_ERROR_H */
+#endif /* _LTTNG_UST_ERROR_H */
#define LTTNG_UST_FIELD_CONVERT_H
#include "field.hpp"
-#include "ust-registry.hpp"
#include "ust-registry-session.hpp"
+#include "ust-registry.hpp"
#include <cstddef>
-#include <vector>
#include <type_traits>
+#include <vector>
namespace lttng {
namespace sessiond {
return ctl_field_quirks(static_cast<enum_type>(lhs) | static_cast<enum_type>(rhs));
}
-std::vector<trace::field::cuptr> create_trace_fields_from_ust_ctl_fields(
- const lttng::sessiond::ust::registry_session& session,
- const lttng_ust_ctl_field *fields,
- std::size_t field_count,
- trace::field_location::root lookup_root,
- ctl_field_quirks quirks = ctl_field_quirks::NONE);
+std::vector<trace::field::cuptr>
+create_trace_fields_from_ust_ctl_fields(const lttng::sessiond::ust::registry_session& session,
+ const lttng_ust_ctl_field *fields,
+ std::size_t field_count,
+ trace::field_location::root lookup_root,
+ ctl_field_quirks quirks = ctl_field_quirks::NONE);
} /* namespace ust */
} /* namespace sessiond */
#include <lttng/lttng.h>
-#include <urcu.h>
#include <functional>
+#include <urcu.h>
struct ust_app;
class registry_channel : public lttng::sessiond::trace::stream_class {
public:
using registered_listener_fn = std::function<void(const registry_channel&)>;
- using event_added_listener_fn = std::function<void(const registry_channel&, const registry_event &)>;
+ using event_added_listener_fn =
+ std::function<void(const registry_channel&, const registry_event&)>;
registry_channel(uint32_t channel_id,
- const lttng::sessiond::trace::abi& trace_abi,
- std::string default_clock_class_name,
- registered_listener_fn channel_registered_listener,
- event_added_listener_fn new_event_listener);
+ const lttng::sessiond::trace::abi& trace_abi,
+ std::string default_clock_class_name,
+ registered_listener_fn channel_registered_listener,
+ event_added_listener_fn new_event_listener);
void add_event(int session_objd,
- int channel_objd,
- std::string name,
- std::string signature,
- std::vector<lttng::sessiond::trace::field::cuptr> event_fields,
- int loglevel_value,
- nonstd::optional<std::string> model_emf_uri,
- lttng_buffer_type buffer_type,
- const ust_app& app,
- uint32_t& out_event_id);
+ int channel_objd,
+ std::string name,
+ std::string signature,
+ std::vector<lttng::sessiond::trace::field::cuptr> event_fields,
+ int loglevel_value,
+ nonstd::optional<std::string> model_emf_uri,
+ lttng_buffer_type buffer_type,
+ const ust_app& app,
+ uint32_t& out_event_id);
~registry_channel() override;
registry_channel(const registry_channel&) = delete;
registry_channel(registry_channel&&) = delete;
private:
void _accept_on_event_classes(
- lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final;
+ lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final;
registered_listener_fn _is_registered_listener;
event_added_listener_fn _event_added_listener;
#include <common/format.hpp>
#include <common/hashtable/hashtable.hpp>
+
#include <vendor/optional.hpp>
#include <typeinfo>
class registry_event : public lttng::sessiond::trace::event_class {
public:
registry_event(unsigned int id,
- unsigned int stream_class_id,
- int session_objd,
- int channel_objd,
- std::string name,
- std::string signature,
- std::vector<lttng::sessiond::trace::field::cuptr> fields,
- int loglevel_value,
- nonstd::optional<std::string> model_emf_uri);
+ unsigned int stream_class_id,
+ int session_objd,
+ int channel_objd,
+ std::string name,
+ std::string signature,
+ std::vector<lttng::sessiond::trace::field::cuptr> fields,
+ int loglevel_value,
+ nonstd::optional<std::string> model_emf_uri);
~registry_event() override = default;
registry_event(const registry_event&) = delete;
registry_event(registry_event&&) = delete;
template <>
struct formatter<lttng::sessiond::ust::registry_event> : formatter<std::string> {
template <typename FormatContextType>
- typename FormatContextType::iterator format(
- const lttng::sessiond::ust::registry_event& event, FormatContextType& ctx)
+ typename FormatContextType::iterator
+ format(const lttng::sessiond::ust::registry_event& event, FormatContextType& ctx)
{
- return format_to(ctx.out(),
- "{{ name = `{}`, signature = `{}`, id = {}, session objd = {}, channel objd = {} }}",
- event.name, event.signature, event.id, event.session_objd,
- event.channel_objd);
+ return format_to(
+ ctx.out(),
+ "{{ name = `{}`, signature = `{}`, id = {}, session objd = {}, channel objd = {} }}",
+ event.name,
+ event.signature,
+ event.id,
+ event.session_objd,
+ event.channel_objd);
}
};
} /* namespace fmt */
#include "trace-class.hpp"
#include "ust-registry-session.hpp"
+#include <lttng/lttng.h>
+
#include <cstdint>
#include <ctime>
-#include <lttng/lttng.h>
#include <string>
#include <unistd.h>
class registry_session_per_pid : public registry_session {
public:
registry_session_per_pid(const struct ust_app& app,
- const struct lttng::sessiond::trace::abi& trace_abi,
- uint32_t major,
- uint32_t minor,
- const char *root_shm_path,
- const char *shm_path,
- uid_t euid,
- gid_t egid,
- uint64_t tracing_id);
+ const struct lttng::sessiond::trace::abi& trace_abi,
+ uint32_t major,
+ uint32_t minor,
+ const char *root_shm_path,
+ const char *shm_path,
+ uid_t euid,
+ gid_t egid,
+ uint64_t tracing_id);
virtual lttng_buffer_type buffering_scheme() const noexcept override final;
virtual void accept(lttng::sessiond::trace::trace_class_environment_visitor&
- environment_visitor) const override final;
+ environment_visitor) const override final;
private:
const unsigned int _tracer_patch_level_version;
#include "trace-class.hpp"
#include "ust-registry-session.hpp"
-#include <cstdint>
#include <lttng/lttng.h>
+
+#include <cstdint>
#include <unistd.h>
namespace lttng {
class registry_session_per_uid : public registry_session {
public:
registry_session_per_uid(const struct lttng::sessiond::trace::abi& trace_abi,
- uint32_t major,
- uint32_t minor,
- const char *root_shm_path,
- const char *shm_path,
- uid_t euid,
- gid_t egid,
- uint64_t tracing_id,
- uid_t tracing_uid);
+ uint32_t major,
+ uint32_t minor,
+ const char *root_shm_path,
+ const char *shm_path,
+ uid_t euid,
+ gid_t egid,
+ uint64_t tracing_id,
+ uid_t tracing_uid);
virtual lttng_buffer_type buffering_scheme() const noexcept override final;
virtual void accept(lttng::sessiond::trace::trace_class_environment_visitor&
- environment_visitor) const override final;
+ environment_visitor) const override final;
private:
-
const uid_t _tracing_uid;
};
#include <common/make-unique-wrapper.hpp>
+#include <lttng/lttng.h>
+
#include <cstdint>
#include <ctime>
-#include <lttng/lttng.h>
#include <string>
#include <unistd.h>
class registry_session : public lttng::sessiond::trace::trace_class {
public:
- using locked_ptr = std::unique_ptr<registry_session,
- lttng::details::create_unique_class<registry_session,
- details::locked_registry_session_release>::
- deleter>;
+ using locked_ptr =
+ std::unique_ptr<registry_session,
+ lttng::details::create_unique_class<
+ registry_session,
+ details::locked_registry_session_release>::deleter>;
virtual lttng_buffer_type buffering_scheme() const noexcept = 0;
locked_ptr lock() noexcept;
void remove_channel(uint64_t channel_key, bool notify);
void create_or_find_enum(int session_objd,
- const char *enum_name,
- struct lttng_ust_ctl_enum_entry *raw_entries,
- size_t nr_entries,
- uint64_t *enum_id);
- registry_enum::const_rcu_protected_reference enumeration(
- const char *enum_name, uint64_t enum_id) const;
+ const char *enum_name,
+ struct lttng_ust_ctl_enum_entry *raw_entries,
+ size_t nr_entries,
+ uint64_t *enum_id);
+ registry_enum::const_rcu_protected_reference enumeration(const char *enum_name,
+ uint64_t enum_id) const;
void regenerate_metadata();
protected:
/* Prevent instanciation of this base class. */
registry_session(const struct lttng::sessiond::trace::abi& abi,
- unsigned int app_tracer_version_major,
- unsigned int app_tracer_version_minor,
- const char *root_shm_path,
- const char *shm_path,
- uid_t euid,
- gid_t egid,
- uint64_t tracing_id);
- void accept(
- trace::trace_class_environment_visitor& environment_visitor) const override;
+ unsigned int app_tracer_version_major,
+ unsigned int app_tracer_version_minor,
+ const char *root_shm_path,
+ const char *shm_path,
+ uid_t euid,
+ gid_t egid,
+ uint64_t tracing_id);
+ void accept(trace::trace_class_environment_visitor& environment_visitor) const override;
void _generate_metadata();
private:
lttng::sessiond::trace::type::cuptr _create_packet_header() const;
void _accept_on_clock_classes(
- lttng::sessiond::trace::trace_class_visitor& trace_class_visitor)
- const final;
+ lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final;
void _accept_on_stream_classes(
- lttng::sessiond::trace::trace_class_visitor& trace_class_visitor)
- const final;
+ lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final;
/* Next channel ID available for a newly registered channel. */
uint32_t _next_channel_id = 0;
#include <string>
#include <type_traits>
-#define CTF_SPEC_MAJOR 1
-#define CTF_SPEC_MINOR 8
+#define CTF_SPEC_MAJOR 1
+#define CTF_SPEC_MINOR 8
struct ust_app;
namespace details {
template <class MappingIntegerType>
-typename trace::typed_enumeration_type<MappingIntegerType>::mappings mappings_from_ust_ctl_entries(
- const lttng_ust_ctl_enum_entry *in_entries, size_t in_entry_count)
+typename trace::typed_enumeration_type<MappingIntegerType>::mappings
+mappings_from_ust_ctl_entries(const lttng_ust_ctl_enum_entry *in_entries, size_t in_entry_count)
{
typename trace::typed_enumeration_type<MappingIntegerType>::mappings mappings;
}
next_range_begin = range_end + 1;
- mappings.emplace_back(entry.string,
- typename trace::typed_enumeration_type<
- MappingIntegerType>::mapping::range_t{
- range_begin, range_end});
+ mappings.emplace_back(
+ entry.string,
+ typename trace::typed_enumeration_type<MappingIntegerType>::mapping::range_t{
+ range_begin, range_end });
}
return mappings;
class registry_enum {
public:
- using const_rcu_protected_reference = lttng::locked_reference<const registry_enum, lttng::urcu::unique_read_lock>;
+ using const_rcu_protected_reference =
+ lttng::locked_reference<const registry_enum, lttng::urcu::unique_read_lock>;
- registry_enum(std::string name, enum lttng::sessiond::trace::integer_type::signedness signedness);
+ registry_enum(std::string name,
+ enum lttng::sessiond::trace::integer_type::signedness signedness);
virtual ~registry_enum() = default;
registry_enum(const registry_enum&) = delete;
registry_enum(registry_enum&&) = delete;
struct rcu_head rcu_head;
friend bool operator==(const registry_enum& lhs, const registry_enum& rhs) noexcept;
+
protected:
virtual bool _is_equal(const registry_enum& other) const noexcept = 0;
};
class registry_typed_enum : public registry_enum {
public:
registry_typed_enum(const char *in_name,
- const lttng_ust_ctl_enum_entry *entries,
- size_t entry_count) :
+ const lttng_ust_ctl_enum_entry *entries,
+ size_t entry_count) :
registry_enum(in_name,
- std::is_signed<MappingIntegerType>::value ?
- lttng::sessiond::trace::integer_type::signedness::SIGNED :
- lttng::sessiond::trace::integer_type::signedness::UNSIGNED),
- _mappings{std::make_shared<
- typename trace::typed_enumeration_type<MappingIntegerType>::mappings>(
- details::mappings_from_ust_ctl_entries<MappingIntegerType>(
- entries, entry_count))}
+ std::is_signed<MappingIntegerType>::value ?
+ lttng::sessiond::trace::integer_type::signedness::SIGNED :
+ lttng::sessiond::trace::integer_type::signedness::UNSIGNED),
+ _mappings{ std::make_shared<
+ typename trace::typed_enumeration_type<MappingIntegerType>::mappings>(
+ details::mappings_from_ust_ctl_entries<MappingIntegerType>(entries,
+ entry_count)) }
{
}
const typename std::shared_ptr<const typename lttng::sessiond::trace::typed_enumeration_type<
- MappingIntegerType>::mappings>
- _mappings;
+ MappingIntegerType>::mappings>
+ _mappings;
protected:
bool _is_equal(const registry_enum& base_other) const noexcept override
{
- const auto &other = static_cast<decltype(*this)&>(base_other);
+ const auto& other = static_cast<decltype(*this)&>(base_other);
/* Don't compare IDs as some comparisons are performed before an id is assigned. */
return this->name == other.name && *this->_mappings == *other._mappings;
*
* Return new instance on success, nullptr on error.
*/
-lttng::sessiond::ust::registry_session *ust_registry_session_per_uid_create(
- const lttng::sessiond::trace::abi& abi,
- uint32_t major,
- uint32_t minor,
- const char *root_shm_path,
- const char *shm_path,
- uid_t euid,
- gid_t egid,
- uint64_t tracing_id,
- uid_t tracing_uid);
+lttng::sessiond::ust::registry_session *
+ust_registry_session_per_uid_create(const lttng::sessiond::trace::abi& abi,
+ uint32_t major,
+ uint32_t minor,
+ const char *root_shm_path,
+ const char *shm_path,
+ uid_t euid,
+ gid_t egid,
+ uint64_t tracing_id,
+ uid_t tracing_uid);
/*
* Create per-pid registry with default values.
*
* Return new instance on success, nullptr on error.
*/
-lttng::sessiond::ust::registry_session *ust_registry_session_per_pid_create(struct ust_app *app,
- const lttng::sessiond::trace::abi& abi,
- uint32_t major,
- uint32_t minor,
- const char *root_shm_path,
- const char *shm_path,
- uid_t euid,
- gid_t egid,
- uint64_t tracing_id);
+lttng::sessiond::ust::registry_session *
+ust_registry_session_per_pid_create(struct ust_app *app,
+ const lttng::sessiond::trace::abi& abi,
+ uint32_t major,
+ uint32_t minor,
+ const char *root_shm_path,
+ const char *shm_path,
+ uid_t euid,
+ gid_t egid,
+ uint64_t tracing_id);
void ust_registry_session_destroy(lttng::sessiond::ust::registry_session *session);
void ust_registry_channel_destroy_event(lttng::sessiond::ust::registry_channel *chan,
- lttng::sessiond::ust::registry_event *event);
+ lttng::sessiond::ust::registry_event *event);
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline
-lttng::sessiond::ust::registry_session *ust_registry_session_per_uid_create(
- uint32_t bits_per_long __attribute__((unused)),
- uint32_t uint8_t_alignment __attribute__((unused)),
- uint32_t uint16_t_alignment __attribute__((unused)),
- uint32_t uint32_t_alignment __attribute__((unused)),
- uint32_t uint64_t_alignment __attribute__((unused)),
- uint32_t long_alignment __attribute__((unused)),
- int byte_order __attribute__((unused)),
- uint32_t major __attribute__((unused)),
- uint32_t minor __attribute__((unused)),
- const char *root_shm_path __attribute__((unused)),
- const char *shm_path __attribute__((unused)),
- uid_t euid __attribute__((unused)),
- gid_t egid __attribute__((unused)),
- uint64_t tracing_id __attribute__((unused)),
- uid_t tracing_uid __attribute__((unused)))
+static inline lttng::sessiond::ust::registry_session *
+ust_registry_session_per_uid_create(uint32_t bits_per_long __attribute__((unused)),
+ uint32_t uint8_t_alignment __attribute__((unused)),
+ uint32_t uint16_t_alignment __attribute__((unused)),
+ uint32_t uint32_t_alignment __attribute__((unused)),
+ uint32_t uint64_t_alignment __attribute__((unused)),
+ uint32_t long_alignment __attribute__((unused)),
+ int byte_order __attribute__((unused)),
+ uint32_t major __attribute__((unused)),
+ uint32_t minor __attribute__((unused)),
+ const char *root_shm_path __attribute__((unused)),
+ const char *shm_path __attribute__((unused)),
+ uid_t euid __attribute__((unused)),
+ gid_t egid __attribute__((unused)),
+ uint64_t tracing_id __attribute__((unused)),
+ uid_t tracing_uid __attribute__((unused)))
{
return nullptr;
}
-static inline
-lttng::sessiond::ust::registry_session *ust_registry_session_per_pid_create(
- struct ust_app *app __attribute__((unused)),
- uint32_t bits_per_long __attribute__((unused)),
- uint32_t uint8_t_alignment __attribute__((unused)),
- uint32_t uint16_t_alignment __attribute__((unused)),
- uint32_t uint32_t_alignment __attribute__((unused)),
- uint32_t uint64_t_alignment __attribute__((unused)),
- uint32_t long_alignment __attribute__((unused)),
- int byte_order __attribute__((unused)),
- uint32_t major __attribute__((unused)),
- uint32_t minor __attribute__((unused)),
- const char *root_shm_path __attribute__((unused)),
- const char *shm_path __attribute__((unused)),
- uid_t euid __attribute__((unused)),
- gid_t egid __attribute__((unused)),
- uint64_t tracing_id __attribute__((unused)))
+static inline lttng::sessiond::ust::registry_session *
+ust_registry_session_per_pid_create(struct ust_app *app __attribute__((unused)),
+ uint32_t bits_per_long __attribute__((unused)),
+ uint32_t uint8_t_alignment __attribute__((unused)),
+ uint32_t uint16_t_alignment __attribute__((unused)),
+ uint32_t uint32_t_alignment __attribute__((unused)),
+ uint32_t uint64_t_alignment __attribute__((unused)),
+ uint32_t long_alignment __attribute__((unused)),
+ int byte_order __attribute__((unused)),
+ uint32_t major __attribute__((unused)),
+ uint32_t minor __attribute__((unused)),
+ const char *root_shm_path __attribute__((unused)),
+ const char *shm_path __attribute__((unused)),
+ uid_t euid __attribute__((unused)),
+ gid_t egid __attribute__((unused)),
+ uint64_t tracing_id __attribute__((unused)))
{
return nullptr;
}
-static inline
-void ust_registry_session_destroy(
- lttng::sessiond::ust::registry_session *session __attribute__((unused)))
-{}
+static inline void ust_registry_session_destroy(lttng::sessiond::ust::registry_session *session
+ __attribute__((unused)))
+{
+}
-static inline
-void ust_registry_destroy_event(
- lttng::sessiond::ust::registry_channel *chan __attribute__((unused)),
- lttng::sessiond::ust::registry_event *event __attribute__((unused)))
-{}
+static inline void ust_registry_destroy_event(lttng::sessiond::ust::registry_channel *chan
+ __attribute__((unused)),
+ lttng::sessiond::ust::registry_event *event
+ __attribute__((unused)))
+{
+}
/* The app object can be NULL for registry shared across applications. */
-static inline
-int ust_metadata_session_statedump(
- lttng::sessiond::ust::registry_session *session __attribute__((unused)))
+static inline int ust_metadata_session_statedump(lttng::sessiond::ust::registry_session *session
+ __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_metadata_channel_statedump(
- lttng::sessiond::ust::registry_session *session __attribute__((unused)),
- lttng::sessiond::ust::registry_channel *chan __attribute__((unused)))
+static inline int ust_metadata_channel_statedump(lttng::sessiond::ust::registry_session *session
+ __attribute__((unused)),
+ lttng::sessiond::ust::registry_channel *chan
+ __attribute__((unused)))
{
return 0;
}
-static inline
-int ust_metadata_event_statedump(
- lttng::sessiond::ust::registry_session *session __attribute__((unused)),
- lttng::sessiond::ust::registry_channel *chan __attribute__((unused)),
- lttng::sessiond::ust::registry_event *event __attribute__((unused)))
+static inline int ust_metadata_event_statedump(lttng::sessiond::ust::registry_session *session
+ __attribute__((unused)),
+ lttng::sessiond::ust::registry_channel *chan
+ __attribute__((unused)),
+ lttng::sessiond::ust::registry_event *event
+ __attribute__((unused)))
{
return 0;
}
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline
-void lttng_ust_handle_sigbus(void *address __attribute__((unused)))
+static inline void lttng_ust_handle_sigbus(void *address __attribute__((unused)))
{
}
const char *get_home_dir(void);
int notify_thread_pipe(int wpipe);
-int loglevels_match(int a_loglevel_type, int a_loglevel_value,
- int b_loglevel_type, int b_loglevel_value, int loglevel_all_type);
+int loglevels_match(int a_loglevel_type,
+ int a_loglevel_value,
+ int b_loglevel_type,
+ int b_loglevel_value,
+ int loglevel_all_type);
const char *session_get_base_path(const struct ltt_session *session);
const char *consumer_output_get_base_path(const struct consumer_output *output);
#ifndef _LTTNG_CMD_H
#define _LTTNG_CMD_H
-#include <lttng/lttng.h>
+#include "conf.hpp"
+#include "utils.hpp"
+
#include <common/common.hpp>
#include <common/defaults.hpp>
-#include "conf.hpp"
-#include "utils.hpp"
+#include <lttng/lttng.h>
-#define DECL_COMMAND(_name) \
- extern int cmd_##_name(int, const char **)
+#define DECL_COMMAND(_name) extern int cmd_##_name(int, const char **)
#ifdef LTTNG_EMBED_HELP
-# define HELP_MSG_NAME help_msg
-# define SHOW_HELP_ERROR_LINE ERR("Cannot show --help for `lttng-%s`", argv[0]);
+#define HELP_MSG_NAME help_msg
+#define SHOW_HELP_ERROR_LINE ERR("Cannot show --help for `lttng-%s`", argv[0]);
#else
-# define HELP_MSG_NAME NULL
-# define SHOW_HELP_ERROR_LINE ;
+#define HELP_MSG_NAME NULL
+#define SHOW_HELP_ERROR_LINE ;
#endif
-#define SHOW_HELP() \
- do { \
- ret = show_cmd_help(argv[0], HELP_MSG_NAME); \
- \
- if (ret) { \
- SHOW_HELP_ERROR_LINE \
- ret = CMD_ERROR; \
- } \
+#define SHOW_HELP() \
+ do { \
+ ret = show_cmd_help(argv[0], HELP_MSG_NAME); \
+ \
+ if (ret) { \
+ SHOW_HELP_ERROR_LINE \
+ ret = CMD_ERROR; \
+ } \
} while (0)
enum cmd_error_code {
DECL_COMMAND(list_triggers);
DECL_COMMAND(remove_trigger);
-extern int cmd_help(int argc, const char **argv,
- const struct cmd_struct commands[]);
+extern int cmd_help(int argc, const char **argv, const struct cmd_struct commands[]);
#endif /* _LTTNG_CMD_H */
event.type = (lttng_event_type) opt_event_type;
if (opt_disable_all) {
- const int disable_ret = lttng_disable_event_ext(handle, &event, channel_name, nullptr);
+ const int disable_ret =
+ lttng_disable_event_ext(handle, &event, channel_name, nullptr);
if (disable_ret < 0) {
ERR("%s", lttng_strerror(command_ret));
#ifndef _LTTNG_LOGLEVEL_UTILS_H
#define _LTTNG_LOGLEVEL_UTILS_H
-#include <lttng/lttng.h>
#include <common/macros.hpp>
+#include <lttng/lttng.h>
+
int loglevel_name_to_value(const char *name, enum lttng_loglevel *loglevel);
bool loglevel_parse_range_string(const char *str,
- enum lttng_loglevel *min,
- enum lttng_loglevel *max);
+ enum lttng_loglevel *min,
+ enum lttng_loglevel *max);
-int loglevel_log4j_name_to_value(
- const char *name, enum lttng_loglevel_log4j *loglevel);
+int loglevel_log4j_name_to_value(const char *name, enum lttng_loglevel_log4j *loglevel);
bool loglevel_log4j_parse_range_string(const char *str,
- enum lttng_loglevel_log4j *min,
- enum lttng_loglevel_log4j *max);
+ enum lttng_loglevel_log4j *min,
+ enum lttng_loglevel_log4j *max);
-int loglevel_jul_name_to_value(
- const char *name, enum lttng_loglevel_jul *loglevel);
+int loglevel_jul_name_to_value(const char *name, enum lttng_loglevel_jul *loglevel);
bool loglevel_jul_parse_range_string(const char *str,
- enum lttng_loglevel_jul *min,
- enum lttng_loglevel_jul *max);
+ enum lttng_loglevel_jul *min,
+ enum lttng_loglevel_jul *max);
-int loglevel_python_name_to_value(
- const char *name, enum lttng_loglevel_python *loglevel);
+int loglevel_python_name_to_value(const char *name, enum lttng_loglevel_python *loglevel);
bool loglevel_python_parse_range_string(const char *str,
- enum lttng_loglevel_python *min,
- enum lttng_loglevel_python *max);
+ enum lttng_loglevel_python *min,
+ enum lttng_loglevel_python *max);
const char *loglevel_value_to_name(int loglevel);
struct lttng_userspace_probe_location;
-int parse_userspace_probe_opts(const char *opt,
- struct lttng_userspace_probe_location **uprobe_loc);
+int parse_userspace_probe_opts(const char *opt, struct lttng_userspace_probe_location **uprobe_loc);
#endif /* SRC_BIN_LTTNG_UPROBE_H */
#ifndef _LTTNG_UTILS_H
#define _LTTNG_UTILS_H
-#include <popt.h>
#include <common/argpar/argpar.h>
#include <common/dynamic-array.hpp>
#include <lttng/lttng.h>
+#include <popt.h>
+
extern char *opt_relayd_path;
extern int opt_no_sessiond;
-extern char * opt_sessiond_path;
+extern char *opt_sessiond_path;
extern pid_t sessiond_pid;
struct cmd_struct;
const char *get_event_type_str(enum lttng_event_type event_type);
-int print_missing_or_multiple_domains(unsigned int domain_count,
- bool include_agent_domains);
+int print_missing_or_multiple_domains(unsigned int domain_count, bool include_agent_domains);
int spawn_relayd(const char *pathname, int port);
int check_relayd(void);
int get_session_stats_str(const char *session_name, char **str);
int show_cmd_help(const char *cmd_name, const char *help_msg);
-int print_trace_archive_location(
- const struct lttng_trace_archive_location *location,
- const char *session_name);
+int print_trace_archive_location(const struct lttng_trace_archive_location *location,
+ const char *session_name);
int validate_exclusion_list(const char *event_name,
- const struct lttng_dynamic_pointer_array *exclusions);
+ const struct lttng_dynamic_pointer_array *exclusions);
#endif /* _LTTNG_UTILS_H */
* Align value to the next multiple of align. Returns val if it already is a
* multiple of align. Align must be a power of two.
*/
-#define __lttng_align_ceil_mask(v, mask) (((v) + (mask)) & ~(mask))
+#define __lttng_align_ceil_mask(v, mask) (((v) + (mask)) & ~(mask))
-#define lttng_align_ceil(v, align) \
- __lttng_align_ceil_mask(v, (__typeof__(v)) (align) - 1)
+#define lttng_align_ceil(v, align) __lttng_align_ceil_mask(v, (__typeof__(v)) (align) -1)
/*
* Align value to the previous multiple of align. Returns val if it already is a
* multiple of align. Align must be a power of two.
*/
-#define __lttng_align_floor_mask(v, mask) ((v) & ~(mask))
+#define __lttng_align_floor_mask(v, mask) ((v) & ~(mask))
-#define lttng_align_floor(v, align) \
- __lttng_align_floor_mask(v, (__typeof__(v)) (align) - 1)
+#define lttng_align_floor(v, align) __lttng_align_floor_mask(v, (__typeof__(v)) (align) -1)
/**
* lttng_offset_align - Calculate the offset needed to align an object on its natural
* Returns the offset that must be added to align towards higher
* addresses.
*/
-#define lttng_offset_align(align_drift, alignment) \
- ({ \
- LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 \
- || ((alignment) & ((alignment) - 1))); \
- (((alignment) - (align_drift)) & ((alignment) - 1)); \
+#define lttng_offset_align(align_drift, alignment) \
+ ({ \
+ LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 || ((alignment) & ((alignment) -1))); \
+ (((alignment) - (align_drift)) & ((alignment) -1)); \
})
/**
*
* Returns the offset that must be substracted to align towards lower addresses.
*/
-#define lttng_offset_align_floor(align_drift, alignment) \
- ({ \
- LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 \
- || ((alignment) & ((alignment) - 1))); \
- (((align_drift) - (alignment)) & ((alignment) - 1)); \
+#define lttng_offset_align_floor(align_drift, alignment) \
+ ({ \
+ LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 || ((alignment) & ((alignment) -1))); \
+ (((align_drift) - (alignment)) & ((alignment) -1)); \
})
#endif /* _LTTNG_ALIGN_H */
#ifndef COMMON_ARGPAR_UTILS_H
#define COMMON_ARGPAR_UTILS_H
-#include <stdarg.h>
-
-#include <common/macros.hpp>
#include <common/argpar/argpar.h>
+#include <common/macros.hpp>
#include <common/string-utils/format.hpp>
+#include <stdarg.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#define WHILE_PARSING_ARG_N_ARG_FMT "While parsing argument #%d (`%s`): "
-enum parse_next_item_status
-{
+enum parse_next_item_status {
PARSE_NEXT_ITEM_STATUS_OK = 0,
PARSE_NEXT_ITEM_STATUS_END = 1,
PARSE_NEXT_ITEM_STATUS_ERROR = -1,
*/
ATTR_FORMAT_PRINTF(7, 8)
enum parse_next_item_status parse_next_item(struct argpar_iter *iter,
- const struct argpar_item **item, int argc_offset,
- const char **argv, bool unknown_opt_is_error,
- const struct argpar_error **error_out,
- const char *context_fmt, ...);
+ const struct argpar_item **item,
+ int argc_offset,
+ const char **argv,
+ bool unknown_opt_is_error,
+ const struct argpar_error **error_out,
+ const char *context_fmt,
+ ...);
#ifdef __cplusplus
}
* Copyright (c) 2020-2021 Simon Marchi <simon.marchi@efficios.com>
*/
+#include "argpar.h"
+
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "argpar.h"
-
-#define ARGPAR_REALLOC(_ptr, _type, _nmemb) \
- ((_type *) realloc(_ptr, (_nmemb) * sizeof(_type)))
+#define ARGPAR_REALLOC(_ptr, _type, _nmemb) ((_type *) realloc(_ptr, (_nmemb) * sizeof(_type)))
-#define ARGPAR_CALLOC(_type, _nmemb) \
- ((_type *) calloc((_nmemb), sizeof(_type)))
+#define ARGPAR_CALLOC(_type, _nmemb) ((_type *) calloc((_nmemb), sizeof(_type)))
#define ARGPAR_ZALLOC(_type) ARGPAR_CALLOC(_type, 1)
* Force usage of the assertion condition to prevent unused variable warnings
* when `assert()` are disabled by the `NDEBUG` definition.
*/
-# define ARGPAR_ASSERT(_cond) ((void) sizeof((void) (_cond), 0))
+#define ARGPAR_ASSERT(_cond) ((void) sizeof((void) (_cond), 0))
#else
-# include <assert.h>
-# define ARGPAR_ASSERT(_cond) assert(_cond)
+#include <assert.h>
+#define ARGPAR_ASSERT(_cond) assert(_cond)
#endif
/*
*/
struct {
unsigned int argc;
- const char * const *argv;
+ const char *const *argv;
const struct argpar_opt_descr *descrs;
} user;
};
ARGPAR_HIDDEN
-enum argpar_item_type argpar_item_type(const struct argpar_item * const item)
+enum argpar_item_type argpar_item_type(const struct argpar_item *const item)
{
ARGPAR_ASSERT(item);
return item->type;
}
ARGPAR_HIDDEN
-const struct argpar_opt_descr *argpar_item_opt_descr(
- const struct argpar_item * const item)
+const struct argpar_opt_descr *argpar_item_opt_descr(const struct argpar_item *const item)
{
ARGPAR_ASSERT(item);
ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_OPT);
}
ARGPAR_HIDDEN
-const char *argpar_item_opt_arg(const struct argpar_item * const item)
+const char *argpar_item_opt_arg(const struct argpar_item *const item)
{
ARGPAR_ASSERT(item);
ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_OPT);
}
ARGPAR_HIDDEN
-const char *argpar_item_non_opt_arg(const struct argpar_item * const item)
+const char *argpar_item_non_opt_arg(const struct argpar_item *const item)
{
ARGPAR_ASSERT(item);
ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
}
ARGPAR_HIDDEN
-unsigned int argpar_item_non_opt_orig_index(
- const struct argpar_item * const item)
+unsigned int argpar_item_non_opt_orig_index(const struct argpar_item *const item)
{
ARGPAR_ASSERT(item);
ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
}
ARGPAR_HIDDEN
-unsigned int argpar_item_non_opt_non_opt_index(
- const struct argpar_item * const item)
+unsigned int argpar_item_non_opt_non_opt_index(const struct argpar_item *const item)
{
ARGPAR_ASSERT(item);
ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
}
ARGPAR_HIDDEN
-void argpar_item_destroy(const struct argpar_item * const item)
+void argpar_item_destroy(const struct argpar_item *const item)
{
if (!item) {
goto end;
}
if (item->type == ARGPAR_ITEM_TYPE_OPT) {
- struct argpar_item_opt * const opt_item =
- (struct argpar_item_opt *) item;
+ struct argpar_item_opt *const opt_item = (struct argpar_item_opt *) item;
free(opt_item->arg);
}
*
* Returns `NULL` on memory error.
*/
-static
-struct argpar_item_opt *create_opt_item(
- const struct argpar_opt_descr * const descr,
- const char * const arg)
+static struct argpar_item_opt *create_opt_item(const struct argpar_opt_descr *const descr,
+ const char *const arg)
{
- struct argpar_item_opt *opt_item =
- ARGPAR_ZALLOC(struct argpar_item_opt);
+ struct argpar_item_opt *opt_item = ARGPAR_ZALLOC(struct argpar_item_opt);
if (!opt_item) {
goto end;
*
* Returns `NULL` on memory error.
*/
-static
-struct argpar_item_non_opt *create_non_opt_item(const char * const arg,
- const unsigned int orig_index,
- const unsigned int non_opt_index)
+static struct argpar_item_non_opt *create_non_opt_item(const char *const arg,
+ const unsigned int orig_index,
+ const unsigned int non_opt_index)
{
- struct argpar_item_non_opt * const non_opt_item =
- ARGPAR_ZALLOC(struct argpar_item_non_opt);
+ struct argpar_item_non_opt *const non_opt_item = ARGPAR_ZALLOC(struct argpar_item_non_opt);
if (!non_opt_item) {
goto end;
* Returns 0 on success (including if `error` is `NULL`) or -1 on memory
* error.
*/
-static
-int set_error(struct argpar_error ** const error,
- enum argpar_error_type type,
- const char * const unknown_opt_name,
- const struct argpar_opt_descr * const opt_descr,
- const bool is_short)
+static int set_error(struct argpar_error **const error,
+ enum argpar_error_type type,
+ const char *const unknown_opt_name,
+ const struct argpar_opt_descr *const opt_descr,
+ const bool is_short)
{
int ret = 0;
(*error)->type = type;
if (unknown_opt_name) {
- (*error)->unknown_opt_name = ARGPAR_CALLOC(char,
- strlen(unknown_opt_name) + 1 + (is_short ? 1 : 2));
+ (*error)->unknown_opt_name =
+ ARGPAR_CALLOC(char, strlen(unknown_opt_name) + 1 + (is_short ? 1 : 2));
if (!(*error)->unknown_opt_name) {
goto error;
}
}
ARGPAR_HIDDEN
-enum argpar_error_type argpar_error_type(
- const struct argpar_error * const error)
+enum argpar_error_type argpar_error_type(const struct argpar_error *const error)
{
ARGPAR_ASSERT(error);
return error->type;
}
ARGPAR_HIDDEN
-unsigned int argpar_error_orig_index(const struct argpar_error * const error)
+unsigned int argpar_error_orig_index(const struct argpar_error *const error)
{
ARGPAR_ASSERT(error);
return error->orig_index;
}
ARGPAR_HIDDEN
-const char *argpar_error_unknown_opt_name(
- const struct argpar_error * const error)
+const char *argpar_error_unknown_opt_name(const struct argpar_error *const error)
{
ARGPAR_ASSERT(error);
ARGPAR_ASSERT(error->type == ARGPAR_ERROR_TYPE_UNKNOWN_OPT);
}
ARGPAR_HIDDEN
-const struct argpar_opt_descr *argpar_error_opt_descr(
- const struct argpar_error * const error, bool * const is_short)
+const struct argpar_opt_descr *argpar_error_opt_descr(const struct argpar_error *const error,
+ bool *const is_short)
{
ARGPAR_ASSERT(error);
ARGPAR_ASSERT(error->type == ARGPAR_ERROR_TYPE_MISSING_OPT_ARG ||
- error->type == ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG);
+ error->type == ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG);
ARGPAR_ASSERT(error->opt_descr);
if (is_short) {
}
ARGPAR_HIDDEN
-void argpar_error_destroy(const struct argpar_error * const error)
+void argpar_error_destroy(const struct argpar_error *const error)
{
if (error) {
free(error->unknown_opt_name);
*
* Returns `NULL` if no descriptor is found.
*/
-static
-const struct argpar_opt_descr *find_descr(
- const struct argpar_opt_descr * const descrs,
- const char short_name, const char * const long_name)
+static const struct argpar_opt_descr *find_descr(const struct argpar_opt_descr *const descrs,
+ const char short_name,
+ const char *const long_name)
{
const struct argpar_opt_descr *descr;
for (descr = descrs; descr->short_name || descr->long_name; descr++) {
- if (short_name && descr->short_name &&
- short_name == descr->short_name) {
+ if (short_name && descr->short_name && short_name == descr->short_name) {
goto end;
}
- if (long_name && descr->long_name &&
- strcmp(long_name, descr->long_name) == 0) {
+ if (long_name && descr->long_name && strcmp(long_name, descr->long_name) == 0) {
goto end;
}
}
* On error (except for `PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY`), sets
* `*error`.
*/
-static
-enum parse_orig_arg_opt_ret parse_short_opt_group(
- const char * const short_opt_group,
- const char * const next_orig_arg,
- const struct argpar_opt_descr * const descrs,
- struct argpar_iter * const iter,
- struct argpar_error ** const error,
- struct argpar_item ** const item)
+static enum parse_orig_arg_opt_ret
+parse_short_opt_group(const char *const short_opt_group,
+ const char *const next_orig_arg,
+ const struct argpar_opt_descr *const descrs,
+ struct argpar_iter *const iter,
+ struct argpar_error **const error,
+ struct argpar_item **const item)
{
enum parse_orig_arg_opt_ret ret = PARSE_ORIG_ARG_OPT_RET_OK;
bool used_next_orig_arg = false;
/* Find corresponding option descriptor */
descr = find_descr(descrs, *iter->short_opt_group_ch, NULL);
if (!descr) {
- const char unknown_opt_name[] =
- {*iter->short_opt_group_ch, '\0'};
+ const char unknown_opt_name[] = { *iter->short_opt_group_ch, '\0' };
ret = PARSE_ORIG_ARG_OPT_RET_ERROR;
- if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT,
- unknown_opt_name, NULL, true)) {
+ if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT, unknown_opt_name, NULL, true)) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY;
}
* We accept `-o ''` (empty option argument), but not
* `-o` alone if an option argument is expected.
*/
- if (!opt_arg || (iter->short_opt_group_ch[1] &&
- strlen(opt_arg) == 0)) {
+ if (!opt_arg || (iter->short_opt_group_ch[1] && strlen(opt_arg) == 0)) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR;
- if (set_error(error, ARGPAR_ERROR_TYPE_MISSING_OPT_ARG,
- NULL, descr, true)) {
+ if (set_error(error, ARGPAR_ERROR_TYPE_MISSING_OPT_ARG, NULL, descr, true)) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY;
}
* On error (except for `PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY`), sets
* `*error`.
*/
-static
-enum parse_orig_arg_opt_ret parse_long_opt(const char * const long_opt_arg,
- const char * const next_orig_arg,
- const struct argpar_opt_descr * const descrs,
- struct argpar_iter * const iter,
- struct argpar_error ** const error,
- struct argpar_item ** const item)
+static enum parse_orig_arg_opt_ret parse_long_opt(const char *const long_opt_arg,
+ const char *const next_orig_arg,
+ const struct argpar_opt_descr *const descrs,
+ struct argpar_iter *const iter,
+ struct argpar_error **const error,
+ struct argpar_item **const item)
{
enum parse_orig_arg_opt_ret ret = PARSE_ORIG_ARG_OPT_RET_OK;
const struct argpar_opt_descr *descr;
/* Isolate the option name */
while (long_opt_name_size > iter->tmp_buf.size - 1) {
iter->tmp_buf.size *= 2;
- iter->tmp_buf.data = ARGPAR_REALLOC(iter->tmp_buf.data,
- char, iter->tmp_buf.size);
+ iter->tmp_buf.data =
+ ARGPAR_REALLOC(iter->tmp_buf.data, char, iter->tmp_buf.size);
if (!iter->tmp_buf.data) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY;
goto error;
if (!descr) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR;
- if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT,
- long_opt_name, NULL, false)) {
+ if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT, long_opt_name, NULL, false)) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY;
}
if (!next_orig_arg) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR;
- if (set_error(error, ARGPAR_ERROR_TYPE_MISSING_OPT_ARG,
- NULL, descr, false)) {
+ if (set_error(error,
+ ARGPAR_ERROR_TYPE_MISSING_OPT_ARG,
+ NULL,
+ descr,
+ false)) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY;
}
*/
ret = PARSE_ORIG_ARG_OPT_RET_ERROR;
- if (set_error(error, ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG,
- NULL, descr, false)) {
+ if (set_error(error, ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG, NULL, descr, false)) {
ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY;
}
* On error (except for `PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY`), sets
* `*error`.
*/
-static
-enum parse_orig_arg_opt_ret parse_orig_arg_opt(const char * const orig_arg,
- const char * const next_orig_arg,
- const struct argpar_opt_descr * const descrs,
- struct argpar_iter * const iter,
- struct argpar_error ** const error,
- struct argpar_item ** const item)
+static enum parse_orig_arg_opt_ret parse_orig_arg_opt(const char *const orig_arg,
+ const char *const next_orig_arg,
+ const struct argpar_opt_descr *const descrs,
+ struct argpar_iter *const iter,
+ struct argpar_error **const error,
+ struct argpar_item **const item)
{
enum parse_orig_arg_opt_ret ret = PARSE_ORIG_ARG_OPT_RET_OK;
if (orig_arg[1] == '-') {
/* Long option */
- ret = parse_long_opt(&orig_arg[2],
- next_orig_arg, descrs, iter, error, item);
+ ret = parse_long_opt(&orig_arg[2], next_orig_arg, descrs, iter, error, item);
} else {
/* Short option */
- ret = parse_short_opt_group(&orig_arg[1],
- next_orig_arg, descrs, iter, error, item);
+ ret = parse_short_opt_group(&orig_arg[1], next_orig_arg, descrs, iter, error, item);
}
return ret;
ARGPAR_HIDDEN
struct argpar_iter *argpar_iter_create(const unsigned int argc,
- const char * const * const argv,
- const struct argpar_opt_descr * const descrs)
+ const char *const *const argv,
+ const struct argpar_opt_descr *const descrs)
{
struct argpar_iter *iter = ARGPAR_ZALLOC(struct argpar_iter);
}
ARGPAR_HIDDEN
-void argpar_iter_destroy(struct argpar_iter * const iter)
+void argpar_iter_destroy(struct argpar_iter *const iter)
{
if (iter) {
free(iter->tmp_buf.data);
}
ARGPAR_HIDDEN
-enum argpar_iter_next_status argpar_iter_next(
- struct argpar_iter * const iter,
- const struct argpar_item ** const item,
- const struct argpar_error ** const error)
+enum argpar_iter_next_status argpar_iter_next(struct argpar_iter *const iter,
+ const struct argpar_item **const item,
+ const struct argpar_error **const error)
{
enum argpar_iter_next_status status;
enum parse_orig_arg_opt_ret parse_orig_arg_opt_ret;
const char *orig_arg;
const char *next_orig_arg;
- struct argpar_error ** const nc_error = (struct argpar_error **) error;
+ struct argpar_error **const nc_error = (struct argpar_error **) error;
ARGPAR_ASSERT(iter->i <= iter->user.argc);
}
orig_arg = iter->user.argv[iter->i];
- next_orig_arg =
- iter->i < (iter->user.argc - 1) ?
- iter->user.argv[iter->i + 1] : NULL;
+ next_orig_arg = iter->i < (iter->user.argc - 1) ? iter->user.argv[iter->i + 1] : NULL;
- if (strcmp(orig_arg, "-") == 0 || strcmp(orig_arg, "--") == 0 ||
- orig_arg[0] != '-') {
+ if (strcmp(orig_arg, "-") == 0 || strcmp(orig_arg, "--") == 0 || orig_arg[0] != '-') {
/* Non-option argument */
- const struct argpar_item_non_opt * const non_opt_item =
- create_non_opt_item(orig_arg, iter->i,
- iter->non_opt_index);
+ const struct argpar_item_non_opt *const non_opt_item =
+ create_non_opt_item(orig_arg, iter->i, iter->non_opt_index);
if (!non_opt_item) {
status = ARGPAR_ITER_NEXT_STATUS_ERROR_MEMORY;
/* Option argument */
parse_orig_arg_opt_ret = parse_orig_arg_opt(orig_arg,
- next_orig_arg, iter->user.descrs, iter, nc_error,
- (struct argpar_item **) item);
+ next_orig_arg,
+ iter->user.descrs,
+ iter,
+ nc_error,
+ (struct argpar_item **) item);
switch (parse_orig_arg_opt_ret) {
case PARSE_ORIG_ARG_OPT_RET_OK:
status = ARGPAR_ITER_NEXT_STATUS_OK;
}
ARGPAR_HIDDEN
-unsigned int argpar_iter_ingested_orig_args(
- const struct argpar_iter * const iter)
+unsigned int argpar_iter_ingested_orig_args(const struct argpar_iter *const iter)
{
return iter->i;
}
* <https://gcc.gnu.org/wiki/Visibility>.
*/
#if defined(_WIN32) || defined(__CYGWIN__)
-# define ARGPAR_HIDDEN
+#define ARGPAR_HIDDEN
#else
-# define ARGPAR_HIDDEN __attribute__((visibility("hidden")))
+#define ARGPAR_HIDDEN __attribute__((visibility("hidden")))
#endif
struct argpar_opt_descr;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-const struct argpar_opt_descr *argpar_item_opt_descr(
- const struct argpar_item *item);
+const struct argpar_opt_descr *argpar_item_opt_descr(const struct argpar_item *item);
/*!
@brief
Item to destroy and variable to reset
(<code>const struct argpar_item *</code> type).
*/
-#define ARGPAR_ITEM_DESTROY_AND_RESET(_item) \
- { \
- argpar_item_destroy(_item); \
- ((_item)) = NULL; \
+#define ARGPAR_ITEM_DESTROY_AND_RESET(_item) \
+ { \
+ argpar_item_destroy(_item); \
+ ((_item)) = NULL; \
}
/// @}
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-const struct argpar_opt_descr *argpar_error_opt_descr(
- const struct argpar_error *error, bool *is_short);
+const struct argpar_opt_descr *argpar_error_opt_descr(const struct argpar_error *error,
+ bool *is_short);
/*!
@brief
const char short_name;
/// Long option name (without the <code>\--</code> prefix), or \c NULL
- const char * const long_name;
+ const char *const long_name;
/// \c true if this option has an argument
const bool with_arg;
};
@endcode
*/
-#define ARGPAR_OPT_DESCR_SENTINEL { -1, '\0', NULL, false }
+#define ARGPAR_OPT_DESCR_SENTINEL \
+ { \
+ -1, '\0', NULL, false \
+ }
/*!
@struct argpar_iter
ARGPAR_HIDDEN
/// @endcond
struct argpar_iter *argpar_iter_create(unsigned int argc,
- const char * const *argv,
- const struct argpar_opt_descr *descrs);
+ const char *const *argv,
+ const struct argpar_opt_descr *descrs);
/*!
@brief
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-enum argpar_iter_next_status argpar_iter_next(
- struct argpar_iter *iter, const struct argpar_item **item,
- const struct argpar_error **error);
+enum argpar_iter_next_status argpar_iter_next(struct argpar_iter *iter,
+ const struct argpar_item **item,
+ const struct argpar_error **error);
/*
* Returns the number of ingested elements from `argv`, as passed to
#define LTTNG_BUFFER_VIEW_H
#include <common/macros.hpp>
+
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
* Note that a buffer view never assumes the ownership of the memory it
* references.
*/
-struct lttng_buffer_view lttng_buffer_view_init(
- const char *src, size_t offset, ptrdiff_t len);
+struct lttng_buffer_view lttng_buffer_view_init(const char *src, size_t offset, ptrdiff_t len);
/**
* Checks if a buffer view is safe to access.
* Note that a buffer view never assumes the ownership of the memory it
* references.
*/
-struct lttng_buffer_view lttng_buffer_view_from_view(
- const struct lttng_buffer_view *src, size_t offset,
- ptrdiff_t len);
+struct lttng_buffer_view
+lttng_buffer_view_from_view(const struct lttng_buffer_view *src, size_t offset, ptrdiff_t len);
/**
* Return a buffer view referencing a subset of the memory referenced by a
* references.
*/
struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer(
- const struct lttng_dynamic_buffer *src, size_t offset,
- ptrdiff_t len);
+ const struct lttng_dynamic_buffer *src, size_t offset, ptrdiff_t len);
/**
* Verify that `buf` contains a string starting at `str` of length
* NULL terminator.
*/
bool lttng_buffer_view_contains_string(const struct lttng_buffer_view *buf,
- const char *str,
- size_t len_with_null_terminator);
+ const char *str,
+ size_t len_with_null_terminator);
#endif /* LTTNG_BUFFER_VIEW_H */
#ifndef _LTTNG_BUG_H
#define _LTTNG_BUG_H
-#include <urcu/compiler.h>
#include <stdio.h>
#include <stdlib.h>
+#include <urcu/compiler.h>
-#define LTTNG_BUG_ON(condition) \
- do { \
- if (caa_unlikely(condition)) { \
- fprintf(stderr, \
- "LTTng BUG in file %s, line %d.\n", \
- __FILE__, __LINE__); \
- exit(EXIT_FAILURE); \
- } \
+#define LTTNG_BUG_ON(condition) \
+ do { \
+ if (caa_unlikely(condition)) { \
+ fprintf(stderr, "LTTng BUG in file %s, line %d.\n", __FILE__, __LINE__); \
+ exit(EXIT_FAILURE); \
+ } \
} while (0)
-#define LTTNG_BUILD_BUG_ON(condition) \
- ((void) sizeof(char[-!!(condition)]))
+#define LTTNG_BUILD_BUG_ON(condition) ((void) sizeof(char[-!!(condition)]))
/**
* LTTNG_BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime
* if the condition is ever true. If the condition is constant and false, no
* code is emitted.
*/
-#define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \
- do { \
- if (__builtin_constant_p(condition)) \
- LTTNG_BUILD_BUG_ON(condition); \
- else \
- LTTNG_BUG_ON(condition); \
+#define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \
+ do { \
+ if (__builtin_constant_p(condition)) \
+ LTTNG_BUILD_BUG_ON(condition); \
+ else \
+ LTTNG_BUG_ON(condition); \
} while (0)
#endif
#ifndef LTTNG_COMMON_BYTECODE_H
#define LTTNG_COMMON_BYTECODE_H
-#include <stdint.h>
-
#include "common/macros.hpp"
#include "common/sessiond-comm/sessiond-comm.hpp"
+#include <stdint.h>
+
/*
* offsets are absolute from start of bytecode.
*/
} LTTNG_PACKED;
enum bytecode_op {
- BYTECODE_OP_UNKNOWN = 0,
+ BYTECODE_OP_UNKNOWN = 0,
- BYTECODE_OP_RETURN = 1,
+ BYTECODE_OP_RETURN = 1,
/* binary */
- BYTECODE_OP_MUL = 2,
- BYTECODE_OP_DIV = 3,
- BYTECODE_OP_MOD = 4,
- BYTECODE_OP_PLUS = 5,
- BYTECODE_OP_MINUS = 6,
- BYTECODE_OP_BIT_RSHIFT = 7,
- BYTECODE_OP_BIT_LSHIFT = 8,
- BYTECODE_OP_BIT_AND = 9,
- BYTECODE_OP_BIT_OR = 10,
- BYTECODE_OP_BIT_XOR = 11,
+ BYTECODE_OP_MUL = 2,
+ BYTECODE_OP_DIV = 3,
+ BYTECODE_OP_MOD = 4,
+ BYTECODE_OP_PLUS = 5,
+ BYTECODE_OP_MINUS = 6,
+ BYTECODE_OP_BIT_RSHIFT = 7,
+ BYTECODE_OP_BIT_LSHIFT = 8,
+ BYTECODE_OP_BIT_AND = 9,
+ BYTECODE_OP_BIT_OR = 10,
+ BYTECODE_OP_BIT_XOR = 11,
/* binary comparators */
- BYTECODE_OP_EQ = 12,
- BYTECODE_OP_NE = 13,
- BYTECODE_OP_GT = 14,
- BYTECODE_OP_LT = 15,
- BYTECODE_OP_GE = 16,
- BYTECODE_OP_LE = 17,
+ BYTECODE_OP_EQ = 12,
+ BYTECODE_OP_NE = 13,
+ BYTECODE_OP_GT = 14,
+ BYTECODE_OP_LT = 15,
+ BYTECODE_OP_GE = 16,
+ BYTECODE_OP_LE = 17,
/* string binary comparator: apply to */
- BYTECODE_OP_EQ_STRING = 18,
- BYTECODE_OP_NE_STRING = 19,
- BYTECODE_OP_GT_STRING = 20,
- BYTECODE_OP_LT_STRING = 21,
- BYTECODE_OP_GE_STRING = 22,
- BYTECODE_OP_LE_STRING = 23,
+ BYTECODE_OP_EQ_STRING = 18,
+ BYTECODE_OP_NE_STRING = 19,
+ BYTECODE_OP_GT_STRING = 20,
+ BYTECODE_OP_LT_STRING = 21,
+ BYTECODE_OP_GE_STRING = 22,
+ BYTECODE_OP_LE_STRING = 23,
/* s64 binary comparator */
- BYTECODE_OP_EQ_S64 = 24,
- BYTECODE_OP_NE_S64 = 25,
- BYTECODE_OP_GT_S64 = 26,
- BYTECODE_OP_LT_S64 = 27,
- BYTECODE_OP_GE_S64 = 28,
- BYTECODE_OP_LE_S64 = 29,
+ BYTECODE_OP_EQ_S64 = 24,
+ BYTECODE_OP_NE_S64 = 25,
+ BYTECODE_OP_GT_S64 = 26,
+ BYTECODE_OP_LT_S64 = 27,
+ BYTECODE_OP_GE_S64 = 28,
+ BYTECODE_OP_LE_S64 = 29,
/* double binary comparator */
- BYTECODE_OP_EQ_DOUBLE = 30,
- BYTECODE_OP_NE_DOUBLE = 31,
- BYTECODE_OP_GT_DOUBLE = 32,
- BYTECODE_OP_LT_DOUBLE = 33,
- BYTECODE_OP_GE_DOUBLE = 34,
- BYTECODE_OP_LE_DOUBLE = 35,
+ BYTECODE_OP_EQ_DOUBLE = 30,
+ BYTECODE_OP_NE_DOUBLE = 31,
+ BYTECODE_OP_GT_DOUBLE = 32,
+ BYTECODE_OP_LT_DOUBLE = 33,
+ BYTECODE_OP_GE_DOUBLE = 34,
+ BYTECODE_OP_LE_DOUBLE = 35,
/* Mixed S64-double binary comparators */
- BYTECODE_OP_EQ_DOUBLE_S64 = 36,
- BYTECODE_OP_NE_DOUBLE_S64 = 37,
- BYTECODE_OP_GT_DOUBLE_S64 = 38,
- BYTECODE_OP_LT_DOUBLE_S64 = 39,
- BYTECODE_OP_GE_DOUBLE_S64 = 40,
- BYTECODE_OP_LE_DOUBLE_S64 = 41,
-
- BYTECODE_OP_EQ_S64_DOUBLE = 42,
- BYTECODE_OP_NE_S64_DOUBLE = 43,
- BYTECODE_OP_GT_S64_DOUBLE = 44,
- BYTECODE_OP_LT_S64_DOUBLE = 45,
- BYTECODE_OP_GE_S64_DOUBLE = 46,
- BYTECODE_OP_LE_S64_DOUBLE = 47,
+ BYTECODE_OP_EQ_DOUBLE_S64 = 36,
+ BYTECODE_OP_NE_DOUBLE_S64 = 37,
+ BYTECODE_OP_GT_DOUBLE_S64 = 38,
+ BYTECODE_OP_LT_DOUBLE_S64 = 39,
+ BYTECODE_OP_GE_DOUBLE_S64 = 40,
+ BYTECODE_OP_LE_DOUBLE_S64 = 41,
+
+ BYTECODE_OP_EQ_S64_DOUBLE = 42,
+ BYTECODE_OP_NE_S64_DOUBLE = 43,
+ BYTECODE_OP_GT_S64_DOUBLE = 44,
+ BYTECODE_OP_LT_S64_DOUBLE = 45,
+ BYTECODE_OP_GE_S64_DOUBLE = 46,
+ BYTECODE_OP_LE_S64_DOUBLE = 47,
/* unary */
- BYTECODE_OP_UNARY_PLUS = 48,
- BYTECODE_OP_UNARY_MINUS = 49,
- BYTECODE_OP_UNARY_NOT = 50,
- BYTECODE_OP_UNARY_PLUS_S64 = 51,
- BYTECODE_OP_UNARY_MINUS_S64 = 52,
- BYTECODE_OP_UNARY_NOT_S64 = 53,
- BYTECODE_OP_UNARY_PLUS_DOUBLE = 54,
- BYTECODE_OP_UNARY_MINUS_DOUBLE = 55,
- BYTECODE_OP_UNARY_NOT_DOUBLE = 56,
+ BYTECODE_OP_UNARY_PLUS = 48,
+ BYTECODE_OP_UNARY_MINUS = 49,
+ BYTECODE_OP_UNARY_NOT = 50,
+ BYTECODE_OP_UNARY_PLUS_S64 = 51,
+ BYTECODE_OP_UNARY_MINUS_S64 = 52,
+ BYTECODE_OP_UNARY_NOT_S64 = 53,
+ BYTECODE_OP_UNARY_PLUS_DOUBLE = 54,
+ BYTECODE_OP_UNARY_MINUS_DOUBLE = 55,
+ BYTECODE_OP_UNARY_NOT_DOUBLE = 56,
/* logical */
- BYTECODE_OP_AND = 57,
- BYTECODE_OP_OR = 58,
+ BYTECODE_OP_AND = 57,
+ BYTECODE_OP_OR = 58,
/* load field ref */
- BYTECODE_OP_LOAD_FIELD_REF = 59,
- BYTECODE_OP_LOAD_FIELD_REF_STRING = 60,
- BYTECODE_OP_LOAD_FIELD_REF_SEQUENCE = 61,
- BYTECODE_OP_LOAD_FIELD_REF_S64 = 62,
- BYTECODE_OP_LOAD_FIELD_REF_DOUBLE = 63,
+ BYTECODE_OP_LOAD_FIELD_REF = 59,
+ BYTECODE_OP_LOAD_FIELD_REF_STRING = 60,
+ BYTECODE_OP_LOAD_FIELD_REF_SEQUENCE = 61,
+ BYTECODE_OP_LOAD_FIELD_REF_S64 = 62,
+ BYTECODE_OP_LOAD_FIELD_REF_DOUBLE = 63,
/* load immediate from operand */
- BYTECODE_OP_LOAD_STRING = 64,
- BYTECODE_OP_LOAD_S64 = 65,
- BYTECODE_OP_LOAD_DOUBLE = 66,
+ BYTECODE_OP_LOAD_STRING = 64,
+ BYTECODE_OP_LOAD_S64 = 65,
+ BYTECODE_OP_LOAD_DOUBLE = 66,
/* cast */
- BYTECODE_OP_CAST_TO_S64 = 67,
- BYTECODE_OP_CAST_DOUBLE_TO_S64 = 68,
- BYTECODE_OP_CAST_NOP = 69,
+ BYTECODE_OP_CAST_TO_S64 = 67,
+ BYTECODE_OP_CAST_DOUBLE_TO_S64 = 68,
+ BYTECODE_OP_CAST_NOP = 69,
/* get context ref */
- BYTECODE_OP_GET_CONTEXT_REF = 70,
- BYTECODE_OP_GET_CONTEXT_REF_STRING = 71,
- BYTECODE_OP_GET_CONTEXT_REF_S64 = 72,
- BYTECODE_OP_GET_CONTEXT_REF_DOUBLE = 73,
+ BYTECODE_OP_GET_CONTEXT_REF = 70,
+ BYTECODE_OP_GET_CONTEXT_REF_STRING = 71,
+ BYTECODE_OP_GET_CONTEXT_REF_S64 = 72,
+ BYTECODE_OP_GET_CONTEXT_REF_DOUBLE = 73,
/* load userspace field ref */
- BYTECODE_OP_LOAD_FIELD_REF_USER_STRING = 74,
- BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75,
+ BYTECODE_OP_LOAD_FIELD_REF_USER_STRING = 74,
+ BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75,
/*
* load immediate star globbing pattern (literal string)
* from immediate
*/
- BYTECODE_OP_LOAD_STAR_GLOB_STRING = 76,
+ BYTECODE_OP_LOAD_STAR_GLOB_STRING = 76,
/* globbing pattern binary operator: apply to */
- BYTECODE_OP_EQ_STAR_GLOB_STRING = 77,
- BYTECODE_OP_NE_STAR_GLOB_STRING = 78,
+ BYTECODE_OP_EQ_STAR_GLOB_STRING = 77,
+ BYTECODE_OP_NE_STAR_GLOB_STRING = 78,
/*
* Instructions for recursive traversal through composed types.
*/
- BYTECODE_OP_GET_CONTEXT_ROOT = 79,
- BYTECODE_OP_GET_APP_CONTEXT_ROOT = 80,
- BYTECODE_OP_GET_PAYLOAD_ROOT = 81,
-
- BYTECODE_OP_GET_SYMBOL = 82,
- BYTECODE_OP_GET_SYMBOL_FIELD = 83,
- BYTECODE_OP_GET_INDEX_U16 = 84,
- BYTECODE_OP_GET_INDEX_U64 = 85,
-
- BYTECODE_OP_LOAD_FIELD = 86,
- BYTECODE_OP_LOAD_FIELD_S8 = 87,
- BYTECODE_OP_LOAD_FIELD_S16 = 88,
- BYTECODE_OP_LOAD_FIELD_S32 = 89,
- BYTECODE_OP_LOAD_FIELD_S64 = 90,
- BYTECODE_OP_LOAD_FIELD_U8 = 91,
- BYTECODE_OP_LOAD_FIELD_U16 = 92,
- BYTECODE_OP_LOAD_FIELD_U32 = 93,
- BYTECODE_OP_LOAD_FIELD_U64 = 94,
- BYTECODE_OP_LOAD_FIELD_STRING = 95,
- BYTECODE_OP_LOAD_FIELD_SEQUENCE = 96,
- BYTECODE_OP_LOAD_FIELD_DOUBLE = 97,
-
- BYTECODE_OP_UNARY_BIT_NOT = 98,
-
- BYTECODE_OP_RETURN_S64 = 99,
+ BYTECODE_OP_GET_CONTEXT_ROOT = 79,
+ BYTECODE_OP_GET_APP_CONTEXT_ROOT = 80,
+ BYTECODE_OP_GET_PAYLOAD_ROOT = 81,
+
+ BYTECODE_OP_GET_SYMBOL = 82,
+ BYTECODE_OP_GET_SYMBOL_FIELD = 83,
+ BYTECODE_OP_GET_INDEX_U16 = 84,
+ BYTECODE_OP_GET_INDEX_U64 = 85,
+
+ BYTECODE_OP_LOAD_FIELD = 86,
+ BYTECODE_OP_LOAD_FIELD_S8 = 87,
+ BYTECODE_OP_LOAD_FIELD_S16 = 88,
+ BYTECODE_OP_LOAD_FIELD_S32 = 89,
+ BYTECODE_OP_LOAD_FIELD_S64 = 90,
+ BYTECODE_OP_LOAD_FIELD_U8 = 91,
+ BYTECODE_OP_LOAD_FIELD_U16 = 92,
+ BYTECODE_OP_LOAD_FIELD_U32 = 93,
+ BYTECODE_OP_LOAD_FIELD_U64 = 94,
+ BYTECODE_OP_LOAD_FIELD_STRING = 95,
+ BYTECODE_OP_LOAD_FIELD_SEQUENCE = 96,
+ BYTECODE_OP_LOAD_FIELD_DOUBLE = 97,
+
+ BYTECODE_OP_UNARY_BIT_NOT = 98,
+
+ BYTECODE_OP_RETURN_S64 = 99,
NR_BYTECODE_OPS,
};
/* skip_offset is absolute from start of bytecode */
struct logical_op {
bytecode_opcode_t op;
- uint16_t skip_offset; /* bytecode insn, if skip second test */
+ uint16_t skip_offset; /* bytecode insn, if skip second test */
} LTTNG_PACKED;
struct cast_op {
};
int bytecode_init(struct lttng_bytecode_alloc **fb);
-int bytecode_push(struct lttng_bytecode_alloc **fb,
- const void *data, uint32_t align, uint32_t len);
+int bytecode_push(struct lttng_bytecode_alloc **fb, const void *data, uint32_t align, uint32_t len);
int bytecode_push_logical(struct lttng_bytecode_alloc **fb,
- struct logical_op *data, uint32_t align, uint32_t len,
- uint16_t *skip_offset);
-struct lttng_bytecode *lttng_bytecode_copy(
- const struct lttng_bytecode *orig_f);
-
-int bytecode_push_get_payload_root(
- struct lttng_bytecode_alloc **bytecode);
-int bytecode_push_get_context_root(
- struct lttng_bytecode_alloc **bytecode);
-int bytecode_push_get_app_context_root(
- struct lttng_bytecode_alloc **bytecode);
-int bytecode_push_get_index_u64(
- struct lttng_bytecode_alloc **bytecode, uint64_t index);
-int bytecode_push_get_symbol(
- struct lttng_bytecode_alloc **bytecode,
- struct lttng_bytecode_alloc **bytecode_reloc,
- const char *symbol);
-
-static inline
-unsigned int bytecode_get_len(struct lttng_bytecode *bytecode)
+ struct logical_op *data,
+ uint32_t align,
+ uint32_t len,
+ uint16_t *skip_offset);
+struct lttng_bytecode *lttng_bytecode_copy(const struct lttng_bytecode *orig_f);
+
+int bytecode_push_get_payload_root(struct lttng_bytecode_alloc **bytecode);
+int bytecode_push_get_context_root(struct lttng_bytecode_alloc **bytecode);
+int bytecode_push_get_app_context_root(struct lttng_bytecode_alloc **bytecode);
+int bytecode_push_get_index_u64(struct lttng_bytecode_alloc **bytecode, uint64_t index);
+int bytecode_push_get_symbol(struct lttng_bytecode_alloc **bytecode,
+ struct lttng_bytecode_alloc **bytecode_reloc,
+ const char *symbol);
+
+static inline unsigned int bytecode_get_len(struct lttng_bytecode *bytecode)
{
return bytecode->len;
}
#include "error.hpp"
#include "macros.hpp"
-#include "runas.hpp"
#include "readwrite.hpp"
+#include "runas.hpp"
#include "time.hpp"
#endif /* _COMMON_H */
#include <common/credentials.hpp>
#include <common/macros.hpp>
+
#include <sys/stat.h>
#include <urcu/ref.h>
void *destroy_cb_data;
};
-static inline
-int lttng_directory_handle_get_dirfd(
- const struct lttng_directory_handle *handle)
+static inline int lttng_directory_handle_get_dirfd(const struct lttng_directory_handle *handle)
{
return handle->dirfd;
}
* The reference to the directory handle must be released using
* lttng_directory_handle_put().
*/
-struct lttng_directory_handle *lttng_directory_handle_create(
- const char *path);
+struct lttng_directory_handle *lttng_directory_handle_create(const char *path);
/*
* Create a new directory handle to a path relative to an existing handle.
* The reference to the directory handle must be released using
* lttng_directory_handle_put().
*/
-struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
- const char *path,
- const struct lttng_directory_handle *ref_handle);
+struct lttng_directory_handle *
+lttng_directory_handle_create_from_handle(const char *path,
+ const struct lttng_directory_handle *ref_handle);
/*
* Create a new directory handle from an existing directory fd.
* The reference to the directory handle must be released using
* lttng_directory_handle_put().
*/
-struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(
- int dirfd);
+struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirfd);
/*
* Copy a directory handle.
* The reference to the directory handle must be released using
* lttng_directory_handle_put().
*/
-struct lttng_directory_handle *lttng_directory_handle_copy(
- const struct lttng_directory_handle *handle);
+struct lttng_directory_handle *
+lttng_directory_handle_copy(const struct lttng_directory_handle *handle);
/*
* Acquire a reference to a directory handle.
/*
* Create a subdirectory relative to a directory handle.
*/
-int lttng_directory_handle_create_subdirectory(
- const struct lttng_directory_handle *handle,
- const char *subdirectory,
- mode_t mode);
+int lttng_directory_handle_create_subdirectory(const struct lttng_directory_handle *handle,
+ const char *subdirectory,
+ mode_t mode);
/*
* Create a subdirectory relative to a directory handle
* as a given user.
*/
-int lttng_directory_handle_create_subdirectory_as_user(
- const struct lttng_directory_handle *handle,
- const char *subdirectory,
- mode_t mode, const struct lttng_credentials *creds);
+int lttng_directory_handle_create_subdirectory_as_user(const struct lttng_directory_handle *handle,
+ const char *subdirectory,
+ mode_t mode,
+ const struct lttng_credentials *creds);
/*
* Recursively create a directory relative to a directory handle.
*/
int lttng_directory_handle_create_subdirectory_recursive(
- const struct lttng_directory_handle *handle,
- const char *subdirectory_path,
- mode_t mode);
+ const struct lttng_directory_handle *handle, const char *subdirectory_path, mode_t mode);
/*
* Recursively create a directory relative to a directory handle
* as a given user.
*/
int lttng_directory_handle_create_subdirectory_recursive_as_user(
- const struct lttng_directory_handle *handle,
- const char *subdirectory_path,
- mode_t mode, const struct lttng_credentials *creds);
+ const struct lttng_directory_handle *handle,
+ const char *subdirectory_path,
+ mode_t mode,
+ const struct lttng_credentials *creds);
/*
* Open a file descriptor to a path relative to a directory handle.
*/
-int lttng_directory_handle_open_file(
- const struct lttng_directory_handle *handle,
- const char *filename,
- int flags, mode_t mode);
+int lttng_directory_handle_open_file(const struct lttng_directory_handle *handle,
+ const char *filename,
+ int flags,
+ mode_t mode);
/*
* Open a file descriptor to a path relative to a directory handle
* as a given user.
*/
-int lttng_directory_handle_open_file_as_user(
- const struct lttng_directory_handle *handle,
- const char *filename,
- int flags, mode_t mode,
- const struct lttng_credentials *creds);
+int lttng_directory_handle_open_file_as_user(const struct lttng_directory_handle *handle,
+ const char *filename,
+ int flags,
+ mode_t mode,
+ const struct lttng_credentials *creds);
/*
* Unlink a file to a path relative to a directory handle.
*/
-int lttng_directory_handle_unlink_file(
- const struct lttng_directory_handle *handle,
- const char *filename);
+int lttng_directory_handle_unlink_file(const struct lttng_directory_handle *handle,
+ const char *filename);
/*
* Unlink a file to a path relative to a directory handle as a given user.
*/
-int lttng_directory_handle_unlink_file_as_user(
- const struct lttng_directory_handle *handle,
- const char *filename,
- const struct lttng_credentials *creds);
+int lttng_directory_handle_unlink_file_as_user(const struct lttng_directory_handle *handle,
+ const char *filename,
+ const struct lttng_credentials *creds);
/*
* Rename a file from a path relative to a directory handle to a new
* name relative to another directory handle.
*/
-int lttng_directory_handle_rename(
- const struct lttng_directory_handle *old_handle,
- const char *old_name,
- const struct lttng_directory_handle *new_handle,
- const char *new_name);
+int lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
+ const char *old_name,
+ const struct lttng_directory_handle *new_handle,
+ const char *new_name);
/*
* Rename a file from a path relative to a directory handle to a new
* name relative to another directory handle as a given user.
*/
-int lttng_directory_handle_rename_as_user(
- const struct lttng_directory_handle *old_handle,
- const char *old_name,
- const struct lttng_directory_handle *new_handle,
- const char *new_name,
- const struct lttng_credentials *creds);
+int lttng_directory_handle_rename_as_user(const struct lttng_directory_handle *old_handle,
+ const char *old_name,
+ const struct lttng_directory_handle *new_handle,
+ const char *new_name,
+ const struct lttng_credentials *creds);
/*
* Remove a subdirectory relative to a directory handle.
*/
-int lttng_directory_handle_remove_subdirectory(
- const struct lttng_directory_handle *handle,
- const char *name);
+int lttng_directory_handle_remove_subdirectory(const struct lttng_directory_handle *handle,
+ const char *name);
/*
* Remove a subdirectory relative to a directory handle as a given user.
*/
-int lttng_directory_handle_remove_subdirectory_as_user(
- const struct lttng_directory_handle *handle,
- const char *name,
- const struct lttng_credentials *creds);
+int lttng_directory_handle_remove_subdirectory_as_user(const struct lttng_directory_handle *handle,
+ const char *name,
+ const struct lttng_credentials *creds);
/*
* Remove a subdirectory and remove its contents if it only
* @flags: enum lttng_directory_handle_rmdir_recursive_flags
*/
int lttng_directory_handle_remove_subdirectory_recursive(
- const struct lttng_directory_handle *handle,
- const char *name, int flags);
+ const struct lttng_directory_handle *handle, const char *name, int flags);
/*
* Remove a subdirectory and remove its contents if it only
* @flags: enum lttng_directory_handle_rmdir_recursive_flags
*/
int lttng_directory_handle_remove_subdirectory_recursive_as_user(
- const struct lttng_directory_handle *handle,
- const char *name,
- const struct lttng_credentials *creds,
- int flags);
+ const struct lttng_directory_handle *handle,
+ const char *name,
+ const struct lttng_credentials *creds,
+ int flags);
/*
* stat() a file relative to a directory handle.
*/
-int lttng_directory_handle_stat(
- const struct lttng_directory_handle *handle,
- const char *name,
- struct stat *stat_buf);
+int lttng_directory_handle_stat(const struct lttng_directory_handle *handle,
+ const char *name,
+ struct stat *stat_buf);
/*
* Returns true if this directory handle is backed by a file
* descriptor, false otherwise.
*/
-bool lttng_directory_handle_uses_fd(
- const struct lttng_directory_handle *handle);
+bool lttng_directory_handle_uses_fd(const struct lttng_directory_handle *handle);
/*
* Compare two directory handles.
* Returns true if the two directory handles are equal, false otherwise.
*/
bool lttng_directory_handle_equals(const struct lttng_directory_handle *lhs,
- const struct lttng_directory_handle *rhs);
-
+ const struct lttng_directory_handle *rhs);
#endif /* _COMPAT_PATH_HANDLE_H */
#include <dirent.h>
#ifdef HAVE_DIRFD
-static inline
-int lttng_dirfd(DIR *dir) {
+static inline int lttng_dirfd(DIR *dir)
+{
return dirfd(dir);
}
#else
-# ifndef __XOPEN_OR_POSIX
-static inline
-int lttng_dirfd(DIR *dir) {
+#ifndef __XOPEN_OR_POSIX
+static inline int lttng_dirfd(DIR *dir)
+{
return dir->dd_fd;
}
-# else
-static inline
-int lttng_dirfd(DIR *dir) {
+#else
+static inline int lttng_dirfd(DIR *dir)
+{
return dir->d_fd;
}
-# endif
+#endif
#endif
#endif /* _COMPAT_DIRENT_H */
#define _COMPAT_ENDIAN_H
#if defined(__linux__) || defined(__CYGWIN__)
-#include <endian.h>
#include <byteswap.h>
+#include <endian.h>
/*
* htobe/betoh are not defined for glibc <2.9, so add them
*/
#ifdef __USE_BSD
/* Conversion interfaces. */
-# include <byteswap.h>
-
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-# ifndef htobe16
-# define htobe16(x) __bswap_16(x)
-# endif
-# ifndef htole16
-# define htole16(x) (x)
-# endif
-# ifndef be16toh
-# define be16toh(x) __bswap_16(x)
-# endif
-# ifndef le16toh
-# define le16toh(x) (x)
-# endif
-
-# ifndef htobe32
-# define htobe32(x) __bswap_32(x)
-# endif
-# ifndef htole32
-# define htole32(x) (x)
-# endif
-# ifndef be32toh
-# define be32toh(x) __bswap_32(x)
-# endif
-# ifndef le32toh
-# define le32toh(x) (x)
-# endif
-
-# ifndef htobe64
-# define htobe64(x) __bswap_64(x)
-# endif
-# ifndef htole64
-# define htole64(x) (x)
-# endif
-# ifndef be64toh
-# define be64toh(x) __bswap_64(x)
-# endif
-# ifndef le64toh
-# define le64toh(x) (x)
-# endif
-
-# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
-# ifndef htobe16
-# define htobe16(x) (x)
-# endif
-# ifndef htole16
-# define htole16(x) __bswap_16(x)
-# endif
-# ifndef be16toh
-# define be16toh(x) (x)
-# endif
-# ifndef le16toh
-# define le16toh(x) __bswap_16(x)
-# endif
-
-# ifndef htobe32
-# define htobe32(x) (x)
-# endif
-# ifndef htole32
-# define htole32(x) __bswap_32(x)
-# endif
-# ifndef be32toh
-# define be32toh(x) (x)
-# endif
-# ifndef le32toh
-# define le32toh(x) __bswap_32(x)
-# endif
-
-# ifndef htobe64
-# define htobe64(x) (x)
-# endif
-# ifndef htole64
-# define htole64(x) __bswap_64(x)
-# endif
-# ifndef be64toh
-# define be64toh(x) (x)
-# endif
-# ifndef le64toh
-# define le64toh(x) __bswap_64(x)
-# endif
-
-# endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#include <byteswap.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef htobe16
+#define htobe16(x) __bswap_16(x)
+#endif
+#ifndef htole16
+#define htole16(x) (x)
+#endif
+#ifndef be16toh
+#define be16toh(x) __bswap_16(x)
+#endif
+#ifndef le16toh
+#define le16toh(x) (x)
+#endif
+
+#ifndef htobe32
+#define htobe32(x) __bswap_32(x)
+#endif
+#ifndef htole32
+#define htole32(x) (x)
+#endif
+#ifndef be32toh
+#define be32toh(x) __bswap_32(x)
+#endif
+#ifndef le32toh
+#define le32toh(x) (x)
+#endif
+
+#ifndef htobe64
+#define htobe64(x) __bswap_64(x)
+#endif
+#ifndef htole64
+#define htole64(x) (x)
+#endif
+#ifndef be64toh
+#define be64toh(x) __bswap_64(x)
+#endif
+#ifndef le64toh
+#define le64toh(x) (x)
+#endif
+
+#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#ifndef htobe16
+#define htobe16(x) (x)
+#endif
+#ifndef htole16
+#define htole16(x) __bswap_16(x)
+#endif
+#ifndef be16toh
+#define be16toh(x) (x)
+#endif
+#ifndef le16toh
+#define le16toh(x) __bswap_16(x)
+#endif
+
+#ifndef htobe32
+#define htobe32(x) (x)
+#endif
+#ifndef htole32
+#define htole32(x) __bswap_32(x)
+#endif
+#ifndef be32toh
+#define be32toh(x) (x)
+#endif
+#ifndef le32toh
+#define le32toh(x) __bswap_32(x)
+#endif
+
+#ifndef htobe64
+#define htobe64(x) (x)
+#endif
+#ifndef htole64
+#define htole64(x) __bswap_64(x)
+#endif
+#ifndef be64toh
+#define be64toh(x) (x)
+#endif
+#ifndef le64toh
+#define le64toh(x) __bswap_64(x)
+#endif
+
+#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
#endif /* __USE_BSD */
#elif defined(__FreeBSD__)
#include <sys/endian.h>
-#define bswap_16(x) bswap16(x)
-#define bswap_32(x) bswap32(x)
-#define bswap_64(x) bswap64(x)
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
#elif defined(__sun__)
#include <sys/byteorder.h>
#define __BYTE_ORDER __BIG_ENDIAN
#endif /* _BIG_ENDIAN */
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-#define BIG_ENDIAN __BIG_ENDIAN
-#define BYTE_ORDER __BYTE_ORDER
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+#define BIG_ENDIAN __BIG_ENDIAN
+#define BYTE_ORDER __BYTE_ORDER
#define betoh16(x) BE_16(x)
#define letoh16(x) LE_16(x)
#define be64toh(x) BE_64(x)
#elif defined(__APPLE__)
-# include <machine/endian.h>
-# include <libkern/OSByteOrder.h>
-
-# if BYTE_ORDER == LITTLE_ENDIAN
-# define htobe16(x) OSSwapConstInt16(x)
-# define htole16(x) (x)
-# define be16toh(x) OSSwapConstInt16(x)
-# define le16toh(x) (x)
-
-# define htobe32(x) OSSwapConstInt32(x)
-# define htole32(x) (x)
-# define be32toh(x) OSSwapConstInt32(x)
-# define le32toh(x) (x)
-
-# define htobe64(x) OSSwapConstInt64(x)
-# define htole64(x) (x)
-# define be64toh(x) OSSwapConstInt64(x)
-# define le64toh(x) (x)
-
-# else /* BYTE_ORDER == LITTLE_ENDIAN */
-# define htobe16(x) (x)
-# define htole16(x) OSSwapConstInt16(x)
-# define be16toh(x) (x)
-# define le16toh(x) OSSwapConstInt16(x)
-
-# define htobe32(x) (x)
-# define htole32(x) OSSwapConstInt32(x)
-# define be32toh(x) (x)
-# define le32toh(x) OSSwapConstInt32(x)
-
-# define htobe64(x) (x)
-# define htole64(x) OSSwapConstInt64(x)
-# define be64toh(x) (x)
-# define le64toh(x) OSSwapConstInt64(x)
-# endif
+#include <libkern/OSByteOrder.h>
+#include <machine/endian.h>
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define htobe16(x) OSSwapConstInt16(x)
+#define htole16(x) (x)
+#define be16toh(x) OSSwapConstInt16(x)
+#define le16toh(x) (x)
+
+#define htobe32(x) OSSwapConstInt32(x)
+#define htole32(x) (x)
+#define be32toh(x) OSSwapConstInt32(x)
+#define le32toh(x) (x)
+
+#define htobe64(x) OSSwapConstInt64(x)
+#define htole64(x) (x)
+#define be64toh(x) OSSwapConstInt64(x)
+#define le64toh(x) (x)
+
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define htobe16(x) (x)
+#define htole16(x) OSSwapConstInt16(x)
+#define be16toh(x) (x)
+#define le16toh(x) OSSwapConstInt16(x)
+
+#define htobe32(x) (x)
+#define htole32(x) OSSwapConstInt32(x)
+#define be32toh(x) (x)
+#define le32toh(x) OSSwapConstInt32(x)
+
+#define htobe64(x) (x)
+#define htole64(x) OSSwapConstInt64(x)
+#define be64toh(x) (x)
+#define le64toh(x) OSSwapConstInt64(x)
+#endif
#else
#error "Please add support for your OS."
#ifndef _COMPAT_FCNTL_H
#define _COMPAT_FCNTL_H
+#include <common/compat/errno.hpp>
+
#include <fcntl.h>
#include <sys/types.h>
-#include <common/compat/errno.hpp>
-
static_assert(sizeof(off_t) == sizeof(int64_t),
"Build system is misconfigured, off_t must be 64-bit wide");
#endif
#ifdef __linux__
-extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
- unsigned int flags);
+extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes, unsigned int flags);
#define lttng_sync_file_range(fd, offset, nbytes, flags) \
compat_sync_file_range(fd, offset, nbytes, flags)
/*
* Possible flags under Linux. Simply nullify them and avoid wrapper.
*/
-#define SYNC_FILE_RANGE_WAIT_AFTER 0
-#define SYNC_FILE_RANGE_WAIT_BEFORE 0
-#define SYNC_FILE_RANGE_WRITE 0
+#define SYNC_FILE_RANGE_WAIT_AFTER 0
+#define SYNC_FILE_RANGE_WAIT_BEFORE 0
+#define SYNC_FILE_RANGE_WRITE 0
-static inline int lttng_sync_file_range(
- int fd __attribute__((unused)),
- off_t offset __attribute__((unused)),
- off_t nbytes __attribute__((unused)),
- unsigned int flags __attribute__((unused)))
+static inline int lttng_sync_file_range(int fd __attribute__((unused)),
+ off_t offset __attribute__((unused)),
+ off_t nbytes __attribute__((unused)),
+ unsigned int flags __attribute__((unused)))
{
return -ENOSYS;
}
/*
* Possible flags under Linux. Simply nullify them and avoid wrappers.
*/
-#define SPLICE_F_MOVE 0
-#define SPLICE_F_NONBLOCK 0
-#define SPLICE_F_MORE 0
-#define SPLICE_F_GIFT 0
+#define SPLICE_F_MOVE 0
+#define SPLICE_F_NONBLOCK 0
+#define SPLICE_F_MORE 0
+#define SPLICE_F_GIFT 0
-static inline ssize_t splice(
- int fd_in __attribute__((unused)),
- loff_t *off_in __attribute__((unused)),
- int fd_out __attribute__((unused)),
- loff_t *off_out __attribute__((unused)),
- size_t len __attribute__((unused)),
- unsigned int flags __attribute__((unused)))
+static inline ssize_t splice(int fd_in __attribute__((unused)),
+ loff_t *off_in __attribute__((unused)),
+ int fd_out __attribute__((unused)),
+ loff_t *off_out __attribute__((unused)),
+ size_t len __attribute__((unused)),
+ unsigned int flags __attribute__((unused)))
{
return -ENOSYS;
}
#endif
-#if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || defined(__APPLE__))
+#if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || \
+ defined(__APPLE__))
#error "Please add support for your OS."
#endif /* __linux__ , __FreeBSD__, __CYGWIN__, __sun__, __APPLE__ */
*
*/
+#include <common/error.hpp>
+
#include <stdlib.h>
-#include <unistd.h>
#include <sys/types.h>
-#include <common/error.hpp>
+#include <unistd.h>
-static inline
-int lttng_is_setuid_setgid()
+static inline int lttng_is_setuid_setgid()
{
return geteuid() != getuid() || getegid() != getgid();
}
-static inline
-char *lttng_secure_getenv(const char *name)
+static inline char *lttng_secure_getenv(const char *name)
{
if (lttng_is_setuid_setgid()) {
WARN("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.",
- name);
+ name);
return nullptr;
}
return getenv(name);
#include <netdb.h>
#ifdef HAVE_GETHOSTBYNAME2
-static inline
-struct hostent *lttng_gethostbyname2(const char *name, int af) {
+static inline struct hostent *lttng_gethostbyname2(const char *name, int af)
+{
return gethostbyname2(name, af);
}
#elif HAVE_GETIPNODEBYNAME
-static inline
-struct hostent *lttng_gethostbyname2(const char *name, int af) {
+static inline struct hostent *lttng_gethostbyname2(const char *name, int af)
+{
int unused;
return getipnodebyname(name, af, AI_DEFAULT, &unused);
}
#else
-# error "Missing compat for gethostbyname2()"
+#error "Missing compat for gethostbyname2()"
#endif
#endif /* _COMPAT_NETDB_H */
#ifdef HAVE_PATHS_H
#include <paths.h>
#else
-# define _PATH_DEVNULL "/dev/null"
+#define _PATH_DEVNULL "/dev/null"
#endif
#endif /* _COMPAT_PATHS_H */
#ifndef _LTT_POLL_H
#define _LTT_POLL_H
+#include <common/common.hpp>
+
#include <string.h>
#include <unistd.h>
-#include <common/common.hpp>
-
/*
* Used by lttng_poll_clean to free the events structure in a lttng_poll_event.
*/
* epoll(7) implementation.
*/
#ifdef HAVE_EPOLL
-#include <sys/epoll.h>
-#include <stdio.h>
-#include <features.h>
#include <common/compat/fcntl.hpp>
+#include <features.h>
+#include <stdio.h>
+#include <sys/epoll.h>
+
/* See man epoll(7) for this define path */
#define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
LPOLLHUP = EPOLLHUP,
LPOLLNVAL = EPOLLHUP,
LPOLLRDHUP = EPOLLRDHUP,
- /* Close on exec feature of epoll */
+/* Close on exec feature of epoll */
#if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC)
LTTNG_CLOEXEC = EPOLL_CLOEXEC,
#else
struct compat_epoll_event {
int epfd;
- uint32_t nb_fd; /* Current number of fd in events */
+ uint32_t nb_fd; /* Current number of fd in events */
uint32_t alloc_size; /* Size of events array */
- uint32_t init_size; /* Initial size of events array */
+ uint32_t init_size; /* Initial size of events array */
struct epoll_event *events;
};
#define lttng_poll_event compat_epoll_event
-static inline int __lttng_epoll_get_prev_fd(struct lttng_poll_event *events,
- int index, uint32_t nb_fd)
+static inline int
+__lttng_epoll_get_prev_fd(struct lttng_poll_event *events, int index, uint32_t nb_fd)
{
LTTNG_ASSERT(events);
LTTNG_ASSERT(index != nb_fd);
* For the following calls, consider 'e' to be a lttng_poll_event pointer and i
* being the index of the events array.
*/
-#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->events[i].data.fd
-#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->events[i].events
-#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->nb_fd
-#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->events_size
-#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) \
- __lttng_epoll_get_prev_fd(LTTNG_REF(e), i, nb_fd)
+#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->events[i].data.fd
+#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->events[i].events
+#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->nb_fd
+#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->events_size
+#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) __lttng_epoll_get_prev_fd(LTTNG_REF(e), i, nb_fd)
/* Create the epoll set. */
-extern int compat_epoll_create(struct lttng_poll_event *events,
- int size, int flags);
-#define lttng_poll_create(events, size, flags) \
- compat_epoll_create(events, size, flags)
+extern int compat_epoll_create(struct lttng_poll_event *events, int size, int flags);
+#define lttng_poll_create(events, size, flags) compat_epoll_create(events, size, flags)
#if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC)
-static inline int compat_glibc_epoll_create(int size __attribute__((unused)),
- int flags)
+static inline int compat_glibc_epoll_create(int size __attribute__((unused)), int flags)
{
return epoll_create1(flags);
}
* Wait on epoll set with the number of fd registered to the lttng_poll_event
* data structure (events).
*/
-extern int compat_epoll_wait(struct lttng_poll_event *events, int timeout,
- bool interruptible);
-#define lttng_poll_wait(events, timeout) \
- compat_epoll_wait(events, timeout, false)
-#define lttng_poll_wait_interruptible(events, timeout) \
- compat_epoll_wait(events, timeout, true)
+extern int compat_epoll_wait(struct lttng_poll_event *events, int timeout, bool interruptible);
+#define lttng_poll_wait(events, timeout) compat_epoll_wait(events, timeout, false)
+#define lttng_poll_wait_interruptible(events, timeout) compat_epoll_wait(events, timeout, true)
/*
* Add a fd to the epoll set and resize the epoll_event structure if needed.
*/
-extern int compat_epoll_add(struct lttng_poll_event *events,
- int fd, uint32_t req_events);
-#define lttng_poll_add(events, fd, req_events) \
- compat_epoll_add(events, fd, req_events)
+extern int compat_epoll_add(struct lttng_poll_event *events, int fd, uint32_t req_events);
+#define lttng_poll_add(events, fd, req_events) compat_epoll_add(events, fd, req_events)
/*
* Remove a fd from the epoll set.
*/
extern int compat_epoll_del(struct lttng_poll_event *events, int fd);
-#define lttng_poll_del(events, fd) \
- compat_epoll_del(events, fd)
+#define lttng_poll_del(events, fd) compat_epoll_del(events, fd)
/*
* Modify an fd's events in the epoll set.
*/
-extern int compat_epoll_mod(struct lttng_poll_event *events,
- int fd, uint32_t req_events);
-#define lttng_poll_mod(events, fd, req_events) \
- compat_epoll_mod(events, fd, req_events)
+extern int compat_epoll_mod(struct lttng_poll_event *events, int fd, uint32_t req_events);
+#define lttng_poll_mod(events, fd, req_events) compat_epoll_mod(events, fd, req_events)
/*
* Set up the poll set limits variable poll_max_size
*/
extern int compat_epoll_set_max_size();
-#define lttng_poll_set_max_size() \
- compat_epoll_set_max_size()
+#define lttng_poll_set_max_size() compat_epoll_set_max_size()
/*
* This function memset with zero the structure since it can be reused at each
static inline void lttng_poll_reset(struct lttng_poll_event *events)
{
if (events && events->events) {
- memset(events->events, 0,
- events->nb_fd * sizeof(struct epoll_event));
+ memset(events->events, 0, events->nb_fd * sizeof(struct epoll_event));
}
}
__lttng_poll_free((void *) events->events);
}
-#else /* HAVE_EPOLL */
+#else /* HAVE_EPOLL */
/*
* Fallback on poll(2) API
*/
};
struct compat_poll_event_array {
- uint32_t nb_fd; /* Current number of fd in events */
+ uint32_t nb_fd; /* Current number of fd in events */
uint32_t alloc_size; /* Size of events array */
/* Initial size of the pollset. We never shrink below that. */
uint32_t init_size;
/* Indicate if wait.events need to be updated from current. */
int need_update:1;
};
-#define lttng_poll_event compat_poll_event
+#define lttng_poll_event compat_poll_event
-static inline int __lttng_poll_get_prev_fd(struct lttng_poll_event *events,
- int index, uint32_t nb_fd)
+static inline int
+__lttng_poll_get_prev_fd(struct lttng_poll_event *events, int index, uint32_t nb_fd)
{
LTTNG_ASSERT(events);
LTTNG_ASSERT(index != nb_fd);
* LTTNG_POLL_GETNB is always used after lttng_poll_wait, thus we can use the
* current list for test compatibility purposes.
*/
-#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->wait.events[i].fd
-#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->wait.events[i].revents
-#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->current.nb_fd
-#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->wait.events_size
-#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) \
- __lttng_poll_get_prev_fd(LTTNG_REF(e), i, nb_fd)
+#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->wait.events[i].fd
+#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->wait.events[i].revents
+#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->current.nb_fd
+#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->wait.events_size
+#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) __lttng_poll_get_prev_fd(LTTNG_REF(e), i, nb_fd)
/*
* Create a pollfd structure of size 'size'.
*/
extern int compat_poll_create(struct lttng_poll_event *events, int size);
-#define lttng_poll_create(events, size, flags) \
- compat_poll_create(events, size)
+#define lttng_poll_create(events, size, flags) compat_poll_create(events, size)
/*
* Wait on poll(2) event with nb_fd registered to the lttng_poll_event data
* structure.
*/
-extern int compat_poll_wait(struct lttng_poll_event *events, int timeout,
- bool interruptible);
-#define lttng_poll_wait(events, timeout) \
- compat_poll_wait(events, timeout, false)
-#define lttng_poll_wait_interruptible(events, timeout) \
- compat_poll_wait(events, timeout, true)
+extern int compat_poll_wait(struct lttng_poll_event *events, int timeout, bool interruptible);
+#define lttng_poll_wait(events, timeout) compat_poll_wait(events, timeout, false)
+#define lttng_poll_wait_interruptible(events, timeout) compat_poll_wait(events, timeout, true)
/*
* Add the fd to the pollfd structure. Resize if needed.
*/
-extern int compat_poll_add(struct lttng_poll_event *events,
- int fd, uint32_t req_events);
-#define lttng_poll_add(events, fd, req_events) \
- compat_poll_add(events, fd, req_events)
+extern int compat_poll_add(struct lttng_poll_event *events, int fd, uint32_t req_events);
+#define lttng_poll_add(events, fd, req_events) compat_poll_add(events, fd, req_events)
/*
* Remove the fd from the pollfd. Memory allocation is done to recreate a new
* one is freed().
*/
extern int compat_poll_del(struct lttng_poll_event *events, int fd);
-#define lttng_poll_del(events, fd) \
- compat_poll_del(events, fd)
+#define lttng_poll_del(events, fd) compat_poll_del(events, fd)
/*
* Modify an fd's events in the poll set.
*/
-extern int compat_poll_mod(struct lttng_poll_event *events,
- int fd, uint32_t req_events);
-#define lttng_poll_mod(events, fd, req_events) \
- compat_poll_mod(events, fd, req_events)
+extern int compat_poll_mod(struct lttng_poll_event *events, int fd, uint32_t req_events);
+#define lttng_poll_mod(events, fd, req_events) compat_poll_mod(events, fd, req_events)
/*
* Set up the poll set limits variable poll_max_size
*/
extern int compat_poll_set_max_size(void);
-#define lttng_poll_set_max_size() \
- compat_poll_set_max_size()
+#define lttng_poll_set_max_size() compat_poll_set_max_size()
/*
* No need to reset a pollfd structure for poll(2)
*/
-static inline void lttng_poll_reset(
- struct lttng_poll_event *events __attribute__((unused)))
-{}
+static inline void lttng_poll_reset(struct lttng_poll_event *events __attribute__((unused)))
+{
+}
/*
* Initialize an already allocated poll event data structure.
#ifndef _COMPAT_PTHREAD_H
#define _COMPAT_PTHREAD_H
-#include <pthread.h>
#include <common/compat/errno.hpp>
+
+#include <pthread.h>
#include <string.h>
#ifdef __FreeBSD__
#define LTTNG_PTHREAD_NAMELEN 16
#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
-static inline
-int lttng_pthread_setname_np(const char *name)
+static inline int lttng_pthread_setname_np(const char *name)
{
/*
* Some implementations don't error out, replicate this behavior for
return pthread_setname_np(pthread_self(), name);
}
#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
-static inline
-int lttng_pthread_setname_np(const char *name)
+static inline int lttng_pthread_setname_np(const char *name)
{
return pthread_setname_np(name);
}
#elif defined(HAVE_PTHREAD_SET_NAME_NP_WITH_TID)
-static inline
-int lttng_pthread_setname_np(const char *name)
+static inline int lttng_pthread_setname_np(const char *name)
{
/* Replicate pthread_setname_np's behavior. */
if (strnlen(name, LTTNG_PTHREAD_NAMELEN) >= LTTNG_PTHREAD_NAMELEN) {
/* Fallback on prtctl on Linux */
#include <sys/prctl.h>
-static inline
-int lttng_pthread_setname_np(const char *name)
+static inline int lttng_pthread_setname_np(const char *name)
{
/* Replicate pthread_setname_np's behavior. */
if (strnlen(name, LTTNG_PTHREAD_NAMELEN) >= LTTNG_PTHREAD_NAMELEN) {
/*
* For platforms without thread name support, do nothing.
*/
-static inline
-int lttng_pthread_setname_np(const char *name)
+static inline int lttng_pthread_setname_np(const char *name)
{
return -ENOSYS;
}
#endif
-
#if defined(HAVE_PTHREAD_GETNAME_NP_WITH_TID)
-static inline
-int lttng_pthread_getname_np(char *name, size_t len)
+static inline int lttng_pthread_getname_np(char *name, size_t len)
{
return pthread_getname_np(pthread_self(), name, len);
}
#elif defined(HAVE_PTHREAD_GETNAME_NP_WITHOUT_TID)
-static inline
-int lttng_pthread_getname_np(char *name, size_t len)
+static inline int lttng_pthread_getname_np(char *name, size_t len)
{
return pthread_getname_np(name, len);
}
#elif defined(HAVE_PTHREAD_GET_NAME_NP_WITH_TID)
-static inline
-int lttng_pthread_getname_np(char *name, size_t len)
+static inline int lttng_pthread_getname_np(char *name, size_t len)
{
pthread_get_name_np(pthread_self(), name, len);
return 0;
/* Fallback on prtctl on Linux */
#include <sys/prctl.h>
-static inline
-int lttng_pthread_getname_np(char *name, size_t len)
+static inline int lttng_pthread_getname_np(char *name, size_t len)
{
return prctl(PR_GET_NAME, name, 0, 0, 0);
}
/*
* For platforms without thread name support, do nothing.
*/
-static inline
-int lttng_pthread_getname_np(char *name, size_t len)
+static inline int lttng_pthread_getname_np(char *name, size_t len)
{
return -ENOSYS;
}
#ifndef _COMPAT_SOCKET_H
#define _COMPAT_SOCKET_H
+#include <common/macros.hpp>
+
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
-#include <common/macros.hpp>
-
#ifndef MSG_NOSIGNAL
-# ifdef SO_NOSIGPIPE
-# define MSG_NOSIGNAL SO_NOSIGPIPE
-# endif
+#ifdef SO_NOSIGPIPE
+#define MSG_NOSIGNAL SO_NOSIGPIPE
+#endif
#endif
#if defined(MSG_NOSIGNAL)
-static inline
-ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg)
+static inline ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg)
{
return recvmsg(sockfd, msg, MSG_NOSIGNAL);
}
#else
-#include <signal.h>
#include <common/compat/errno.hpp>
-static inline
-ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg)
+#include <signal.h>
+
+static inline ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg)
{
ssize_t received;
int saved_err;
int ret;
do {
- ret = sigtimedwait(&sigpipe_set, NULL,
- &timeout);
+ ret = sigtimedwait(&sigpipe_set, NULL, &timeout);
} while (ret == -1 && errno == EINTR);
}
if (!sigpipe_was_pending) {
#ifdef __sun__
-# ifndef CMSG_ALIGN
-# ifdef _CMSG_DATA_ALIGN
-# define CMSG_ALIGN(len) _CMSG_DATA_ALIGN(len)
-# else
- /* aligning to sizeof (long) is assumed to be portable (fd.o#40235) */
-# define CMSG_ALIGN(len) (((len) + sizeof (long) - 1) & ~(sizeof (long) - 1))
-# endif
-# ifndef CMSG_SPACE
-# define CMSG_SPACE(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + CMSG_ALIGN (len))
-# endif
-# ifndef CMSG_LEN
-# define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
-# endif
-# endif
+#ifndef CMSG_ALIGN
+#ifdef _CMSG_DATA_ALIGN
+#define CMSG_ALIGN(len) _CMSG_DATA_ALIGN(len)
+#else
+/* aligning to sizeof (long) is assumed to be portable (fd.o#40235) */
+#define CMSG_ALIGN(len) (((len) + sizeof(long) - 1) & ~(sizeof(long) - 1))
+#endif
+#ifndef CMSG_SPACE
+#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+#endif
+#ifndef CMSG_LEN
+#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+#endif
+#endif
#include <ucred.h>
-static inline
-int getpeereid(int s, uid_t *euid, gid_t *gid)
+static inline int getpeereid(int s, uid_t *euid, gid_t *gid)
{
int ret = 0;
ucred_t *ucred = NULL;
}
#endif /* __sun__ */
-
#if defined(__linux__) || defined(__CYGWIN__)
#define LTTNG_SOCK_CREDS SCM_CREDENTIALS
#ifdef __APPLE__
-static inline
-int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
+static inline int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
{
socklen_t pid_len = (socklen_t) sizeof(*pid);
#elif defined(__sun__)
/* Use the getpeerucreds interface on Solaris. */
-static inline
-int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
+static inline int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
{
int ret = 0;
ucred_t *ucred = NULL;
#include <sys/ucred.h>
-static inline
-int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
+static inline int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
{
int ret;
struct xucred sock_creds = {};
socklen_t sock_creds_len = (socklen_t) sizeof(sock_creds);
/* Only available in FreeBSD 13.0 and up. */
- ret = getsockopt(socket_fd, SOL_LOCAL, LOCAL_PEERCRED, &sock_creds,
- &sock_creds_len);
+ ret = getsockopt(socket_fd, SOL_LOCAL, LOCAL_PEERCRED, &sock_creds, &sock_creds_len);
if (ret) {
goto end;
}
#endif /* __APPLE__ */
-
-static inline
-int lttng_get_unix_socket_peer_creds(int socket_fd, struct lttng_sock_cred *creds)
+static inline int lttng_get_unix_socket_peer_creds(int socket_fd, struct lttng_sock_cred *creds)
{
int ret;
#ifndef _COMPAT_STRING_H
#define _COMPAT_STRING_H
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#ifdef HAVE_STRNLEN
-static inline
-size_t lttng_strnlen(const char *str, size_t max)
+static inline size_t lttng_strnlen(const char *str, size_t max)
{
return strnlen(str, max);
}
#else
-static inline
-size_t lttng_strnlen(const char *str, size_t max)
+static inline size_t lttng_strnlen(const char *str, size_t max)
{
size_t ret;
const char *end;
#endif /* HAVE_STRNLEN */
#ifdef HAVE_STRNDUP
-static inline
-char *lttng_strndup(const char *s, size_t n)
+static inline char *lttng_strndup(const char *s, size_t n)
{
return strndup(s, n);
}
#else
-static inline
-char *lttng_strndup(const char *s, size_t n)
+static inline char *lttng_strndup(const char *s, size_t n)
{
char *ret;
size_t navail;
#endif /* HAVE_FLS */
#ifdef HAVE_MEMRCHR
-static inline
-void *lttng_memrchr(const void *s, int c, size_t n)
+static inline void *lttng_memrchr(const void *s, int c, size_t n)
{
return (void *) memrchr(s, c, n);
}
#else
-static inline
-void *lttng_memrchr(const void *s, int c, size_t n)
+static inline void *lttng_memrchr(const void *s, int c, size_t n)
{
int i;
const char *str = (const char *) s;
- for (i = n-1; i >= 0; i--) {
- if (str[i] == (char)c) {
- return (void *)(str+i);
+ for (i = n - 1; i >= 0; i--) {
+ if (str[i] == (char) c) {
+ return (void *) (str + i);
}
}
return NULL;
typedef uint64_t timer_t;
-#include <mach/mach.h>
-#include <mach/clock.h>
#include <common/compat/errno.hpp>
+#include <mach/clock.h>
+#include <mach/mach.h>
+
#undef NSEC_PER_SEC
#undef NSEC_PER_MSEC
#undef NSEC_PER_USEC
#if defined(__APPLE__) && !defined(LTTNG_HAVE_CLOCK_GETTIME)
typedef int clockid_t;
-#define CLOCK_REALTIME CALENDAR_CLOCK
+#define CLOCK_REALTIME CALENDAR_CLOCK
#define CLOCK_MONOTONIC SYSTEM_CLOCK
-static inline
-int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp)
+static inline int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp)
{
int ret = 0;
clock_serv_t clock;
#else /* __APPLE__ && !LTTNG_HAVE_CLOCK_GETTIME */
-static inline
-int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp)
+static inline int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp)
{
return clock_gettime(clk_id, tp);
}
#include <lttng/lttng-export.h>
-extern const char * const config_element_all;
-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_lookup_tracepoint_sdt;
-extern const char * const config_element_userspace_probe_location_binary_path;
-extern const char * const config_element_userspace_probe_function_attributes;
-extern const char * const config_element_userspace_probe_function_location_function_name;
-extern const char * const config_element_userspace_probe_tracepoint_attributes;
-extern const char * const config_element_userspace_probe_tracepoint_location_provider_name;
-extern const char * const config_element_userspace_probe_tracepoint_location_probe_name;
-extern const char * const config_element_name;
-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;
-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;
-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;
-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;
-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;
-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_process_attr_tracker_vuid;
-extern const char * const config_element_process_attr_tracker_gid;
-extern const char * const config_element_process_attr_tracker_vgid;
-extern const char * const config_element_process_attr_trackers;
-extern const char * const config_element_process_attr_values;
-extern const char * const config_element_process_attr_value_type;
-extern const char * const config_element_process_attr_pid_value;
-extern const char * const config_element_process_attr_vpid_value;
-extern const char * const config_element_process_attr_uid_value;
-extern const char * const config_element_process_attr_vuid_value;
-extern const char * const config_element_process_attr_gid_value;
-extern const char * const config_element_process_attr_vgid_value;
-extern const char * const config_element_process_attr_tracker_type;
-extern const char * const config_element_rotation_timer_interval;
-extern const char * const config_element_rotation_size;
-extern const char * const config_element_rotation_schedule;
+extern const char *const config_element_all;
+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_lookup_tracepoint_sdt;
+extern const char *const config_element_userspace_probe_location_binary_path;
+extern const char *const config_element_userspace_probe_function_attributes;
+extern const char *const config_element_userspace_probe_function_location_function_name;
+extern const char *const config_element_userspace_probe_tracepoint_attributes;
+extern const char *const config_element_userspace_probe_tracepoint_location_provider_name;
+extern const char *const config_element_userspace_probe_tracepoint_location_probe_name;
+extern const char *const config_element_name;
+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;
+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;
+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;
+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;
+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;
+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_process_attr_tracker_vuid;
+extern const char *const config_element_process_attr_tracker_gid;
+extern const char *const config_element_process_attr_tracker_vgid;
+extern const char *const config_element_process_attr_trackers;
+extern const char *const config_element_process_attr_values;
+extern const char *const config_element_process_attr_value_type;
+extern const char *const config_element_process_attr_pid_value;
+extern const char *const config_element_process_attr_vpid_value;
+extern const char *const config_element_process_attr_uid_value;
+extern const char *const config_element_process_attr_vuid_value;
+extern const char *const config_element_process_attr_gid_value;
+extern const char *const config_element_process_attr_vgid_value;
+extern const char *const config_element_process_attr_tracker_type;
+extern const char *const config_element_rotation_timer_interval;
+extern const char *const config_element_rotation_size;
+extern const char *const config_element_rotation_schedule;
-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;
+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;
-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;
+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;
-LTTNG_EXPORT extern const char * const config_overwrite_mode_discard;
-LTTNG_EXPORT 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;
-LTTNG_EXPORT extern const char * const config_output_type_splice;
-LTTNG_EXPORT 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;
-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;
+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;
-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;
-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;
+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;
+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;
-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;
-extern const char * const config_event_context_need_reschedule;
-extern const char * const config_event_context_migratable;
-extern const char * const config_event_context_callstack_user;
-extern const char * const config_event_context_callstack_kernel;
+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;
+extern const char *const config_event_context_need_reschedule;
+extern const char *const config_event_context_migratable;
+extern const char *const config_event_context_callstack_user;
+extern const char *const config_event_context_callstack_kernel;
-extern const char * const config_element_rotation_schedules;
-extern const char * const config_element_rotation_schedule_periodic;
-extern const char * const config_element_rotation_schedule_periodic_time_us;
-extern const char * const config_element_rotation_schedule_size_threshold;
-extern const char * const config_element_rotation_schedule_size_threshold_bytes;
-extern const char * const config_event_context_cgroup_ns;
-extern const char * const config_event_context_ipc_ns;
-extern const char * const config_event_context_mnt_ns;
-extern const char * const config_event_context_net_ns;
-extern const char * const config_event_context_pid_ns;
-extern const char * const config_event_context_time_ns;
-extern const char * const config_event_context_user_ns;
-extern const char * const config_event_context_uts_ns;
-extern const char * const config_event_context_uid;
-extern const char * const config_event_context_euid;
-extern const char * const config_event_context_suid;
-extern const char * const config_event_context_gid;
-extern const char * const config_event_context_egid;
-extern const char * const config_event_context_sgid;
-extern const char * const config_event_context_vuid;
-extern const char * const config_event_context_veuid;
-extern const char * const config_event_context_vsuid;
-extern const char * const config_event_context_vgid;
-extern const char * const config_event_context_vegid;
-extern const char * const config_event_context_vsgid;
+extern const char *const config_element_rotation_schedules;
+extern const char *const config_element_rotation_schedule_periodic;
+extern const char *const config_element_rotation_schedule_periodic_time_us;
+extern const char *const config_element_rotation_schedule_size_threshold;
+extern const char *const config_element_rotation_schedule_size_threshold_bytes;
+extern const char *const config_event_context_cgroup_ns;
+extern const char *const config_event_context_ipc_ns;
+extern const char *const config_event_context_mnt_ns;
+extern const char *const config_event_context_net_ns;
+extern const char *const config_event_context_pid_ns;
+extern const char *const config_event_context_time_ns;
+extern const char *const config_event_context_user_ns;
+extern const char *const config_event_context_uts_ns;
+extern const char *const config_event_context_uid;
+extern const char *const config_event_context_euid;
+extern const char *const config_event_context_suid;
+extern const char *const config_event_context_gid;
+extern const char *const config_event_context_egid;
+extern const char *const config_event_context_sgid;
+extern const char *const config_event_context_vuid;
+extern const char *const config_event_context_veuid;
+extern const char *const config_event_context_vsuid;
+extern const char *const config_event_context_vgid;
+extern const char *const config_event_context_vegid;
+extern const char *const config_event_context_vsgid;
#endif /* CONFIG_SESSION_INTERNAL_H */
#include <common/config/config-session-abi.hpp>
#include <common/macros.hpp>
+
#include <stdint.h>
struct config_load_session_override_attr {
* Returns zero if the XML element could be opened.
* Negative values indicate an error.
*/
-int config_writer_open_element(struct config_writer *writer,
- const char *element_name);
+int config_writer_open_element(struct config_writer *writer, const char *element_name);
/*
* Write an element tag attribute.
* Negative values indicate an error.
*/
int config_writer_write_attribute(struct config_writer *writer,
- const char *name, const char *value);
+ const char *name,
+ const char *value);
/*
* Close the current element tag.
* Negative values indicate an error.
*/
int config_writer_write_element_unsigned_int(struct config_writer *writer,
- const char *element_name, uint64_t value);
+ const char *element_name,
+ uint64_t value);
/*
* Write an element of type signed int.
* Negative values indicate an error.
*/
int config_writer_write_element_signed_int(struct config_writer *writer,
- const char *element_name, int64_t value);
+ const char *element_name,
+ int64_t value);
/*
* Write an element of type boolean.
* Negative values indicate an error.
*/
int config_writer_write_element_bool(struct config_writer *writer,
- const char *element_name, int value);
+ const char *element_name,
+ int value);
/*
* Write an element of type string.
* Negative values indicate an error.
*/
int config_writer_write_element_string(struct config_writer *writer,
- const char *element_name, const char *value);
+ const char *element_name,
+ const char *value);
/*
* Write an element of type double.
* Negative values indicate an error.
*/
int config_writer_write_element_double(struct config_writer *writer,
- const char *element_name,
- double value);
+ const char *element_name,
+ double value);
/*
* Load session configurations from a file.
* Returns zero if the session could be loaded successfully. Returns
* a negative LTTNG_ERR code on error.
*/
-int config_load_session(const char *path, const char *session_name,
- int overwrite, unsigned int autoload,
- const struct config_load_session_override_attr *overrides);
+int config_load_session(const char *path,
+ const char *session_name,
+ int overwrite,
+ unsigned int autoload,
+ const struct config_load_session_override_attr *overrides);
#endif /* _CONFIG_H */
enum consumer_metadata_cache_write_status
consumer_metadata_cache_write(struct consumer_metadata_cache *cache,
- unsigned int offset, unsigned int len, uint64_t version,
- const char *data);
+ unsigned int offset,
+ unsigned int len,
+ uint64_t version,
+ const char *data);
int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel);
void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel);
int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
- uint64_t offset, int timer);
+ uint64_t offset,
+ int timer);
#endif /* CONSUMER_METADATA_CACHE_H */
*
* The channel lock MUST be acquired.
*/
-struct lttng_consumer_stream *consumer_stream_create(
- struct lttng_consumer_channel *channel,
- uint64_t channel_key,
- uint64_t stream_key,
- const char *channel_name,
- uint64_t relayd_id,
- uint64_t session_id,
- struct lttng_trace_chunk *trace_chunk,
- int cpu,
- int *alloc_ret,
- enum consumer_channel_type type,
- unsigned int monitor);
+struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_channel *channel,
+ uint64_t channel_key,
+ uint64_t stream_key,
+ const char *channel_name,
+ uint64_t relayd_id,
+ uint64_t session_id,
+ struct lttng_trace_chunk *trace_chunk,
+ int cpu,
+ int *alloc_ret,
+ enum consumer_channel_type type,
+ unsigned int monitor);
/*
* Close stream's file descriptors and, if needed, close stream also on the
* a hash table before calling this.
*/
void consumer_stream_relayd_close(struct lttng_consumer_stream *stream,
- struct consumer_relayd_sock_pair *relayd);
+ struct consumer_relayd_sock_pair *relayd);
/*
* Delete the stream from all possible hash tables.
*
* The consumer data lock MUST be acquired.
*/
-void consumer_stream_delete(struct lttng_consumer_stream *stream,
- struct lttng_ht *ht);
+void consumer_stream_delete(struct lttng_consumer_stream *stream, struct lttng_ht *ht);
/*
* Free the given stream within a RCU call.
*
* This MUST be called WITHOUT the consumer data and stream lock acquired.
*/
-void consumer_stream_destroy(struct lttng_consumer_stream *stream,
- struct lttng_ht *ht);
+void consumer_stream_destroy(struct lttng_consumer_stream *stream, struct lttng_ht *ht);
/*
* Destroy the stream's buffers on the tracer side. This is also called in a
* Write index of a specific stream either on the relayd or local disk.
*/
int consumer_stream_write_index(struct lttng_consumer_stream *stream,
- struct ctf_packet_index *index);
+ struct ctf_packet_index *index);
-int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
- uint64_t session_id);
+int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx, uint64_t session_id);
/*
* Create the output files of a local stream.
*
* This must be called with the channel's and the stream's lock held.
*/
-int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
- bool create_index);
+int consumer_stream_create_output_files(struct lttng_consumer_stream *stream, bool create_index);
/*
* Rotate the output files of a local stream. This will change the
*
* This must be called on initialization before any subbuffer is consumed.
*/
-int consumer_stream_enable_metadata_bucketization(
- struct lttng_consumer_stream *stream);
+int consumer_stream_enable_metadata_bucketization(struct lttng_consumer_stream *stream);
/*
* Set the version of a metadata stream (i.e. following a metadata
* Changing the version of a metadata stream will cause any bucketized metadata
* to be discarded and will mark the metadata stream for future `reset`.
*/
-void consumer_stream_metadata_set_version(
- struct lttng_consumer_stream *stream, uint64_t new_version);
+void consumer_stream_metadata_set_version(struct lttng_consumer_stream *stream,
+ uint64_t new_version);
/*
* Attempt to open a packet in a stream.
*
* This function must be called with the stream and channel locks held.
*/
-enum consumer_stream_open_packet_status consumer_stream_open_packet(
- struct lttng_consumer_stream *stream);
+enum consumer_stream_open_packet_status
+consumer_stream_open_packet(struct lttng_consumer_stream *stream);
/*
* Flush a stream's buffer.
*
* This function must be called with the stream and channel locks held.
*/
-int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream,
- bool producer_active);
+int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream, bool producer_active);
#endif /* LTTNG_CONSUMER_STREAM_H */
#ifndef CONSUMER_TIMER_H
#define CONSUMER_TIMER_H
-#include <pthread.h>
-
#include "consumer.hpp"
-#define LTTNG_CONSUMER_SIG_SWITCH ((SIGRTMIN + 10))
-#define LTTNG_CONSUMER_SIG_TEARDOWN ((SIGRTMIN + 11))
-#define LTTNG_CONSUMER_SIG_LIVE ((SIGRTMIN + 12))
-#define LTTNG_CONSUMER_SIG_MONITOR ((SIGRTMIN + 13))
-#define LTTNG_CONSUMER_SIG_EXIT ((SIGRTMIN + 14))
+#include <pthread.h>
+
+#define LTTNG_CONSUMER_SIG_SWITCH ((SIGRTMIN + 10))
+#define LTTNG_CONSUMER_SIG_TEARDOWN ((SIGRTMIN + 11))
+#define LTTNG_CONSUMER_SIG_LIVE ((SIGRTMIN + 12))
+#define LTTNG_CONSUMER_SIG_MONITOR ((SIGRTMIN + 13))
+#define LTTNG_CONSUMER_SIG_EXIT ((SIGRTMIN + 14))
#define CLOCKID CLOCK_MONOTONIC
* exclusion.
*/
struct timer_signal_data {
- pthread_t tid; /* thread id managing signals */
+ pthread_t tid; /* thread id managing signals */
int setup_done;
int qs_done;
pthread_mutex_t lock;
};
void consumer_timer_switch_start(struct lttng_consumer_channel *channel,
- unsigned int switch_timer_interval_us);
+ unsigned int switch_timer_interval_us);
void consumer_timer_switch_stop(struct lttng_consumer_channel *channel);
void consumer_timer_live_start(struct lttng_consumer_channel *channel,
- unsigned int live_timer_interval_us);
+ unsigned int live_timer_interval_us);
void consumer_timer_live_stop(struct lttng_consumer_channel *channel);
int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
- unsigned int monitor_timer_interval_us);
+ unsigned int monitor_timer_interval_us);
int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel);
void *consumer_timer_thread(void *data);
int consumer_signal_init();
#ifndef LIB_CONSUMER_H
#define LIB_CONSUMER_H
+#include <common/buffer-view.hpp>
+#include <common/compat/fcntl.hpp>
+#include <common/credentials.hpp>
+#include <common/dynamic-array.hpp>
+#include <common/hashtable/hashtable.hpp>
+#include <common/index/ctf-index.hpp>
+#include <common/pipe.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/trace-chunk-registry.hpp>
+#include <common/uuid.hpp>
+
+#include <lttng/lttng.h>
+
#include <limits.h>
#include <poll.h>
#include <stdint.h>
#include <unistd.h>
#include <urcu/list.h>
-#include <lttng/lttng.h>
-
-#include <common/hashtable/hashtable.hpp>
-#include <common/compat/fcntl.hpp>
-#include <common/uuid.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/pipe.hpp>
-#include <common/index/ctf-index.hpp>
-#include <common/trace-chunk-registry.hpp>
-#include <common/credentials.hpp>
-#include <common/buffer-view.hpp>
-#include <common/dynamic-array.hpp>
-
struct lttng_consumer_local_data;
/* Commands for consumer */
/* pause, delete, active depending on fd state */
LTTNG_CONSUMER_UPDATE_STREAM,
/* inform the consumer to quit when all fd has hang up */
- LTTNG_CONSUMER_STOP, /* deprecated */
+ LTTNG_CONSUMER_STOP, /* deprecated */
LTTNG_CONSUMER_ADD_RELAYD_SOCKET,
/* Inform the consumer to kill a specific relayd connection */
LTTNG_CONSUMER_DESTROY_RELAYD,
};
enum consumer_channel_output {
- CONSUMER_CHANNEL_MMAP = 0,
- CONSUMER_CHANNEL_SPLICE = 1,
+ CONSUMER_CHANNEL_MMAP = 0,
+ CONSUMER_CHANNEL_SPLICE = 1,
};
enum consumer_channel_type {
- CONSUMER_CHANNEL_TYPE_METADATA = 0,
- CONSUMER_CHANNEL_TYPE_DATA = 1,
+ CONSUMER_CHANNEL_TYPE_METADATA = 0,
+ CONSUMER_CHANNEL_TYPE_DATA = 1,
};
enum sync_metadata_status {
enum consumer_channel_type type;
/* For UST */
- uid_t ust_app_uid; /* Application UID. */
+ uid_t ust_app_uid; /* Application UID. */
struct lttng_ust_ctl_consumer_channel *uchan;
unsigned char uuid[LTTNG_UUID_STR_LEN];
/*
* Returns the number of bytes read, or negative error value.
*/
ssize_t (*on_buffer_ready)(struct lttng_consumer_stream *stream,
- struct lttng_consumer_local_data *ctx,
- bool locked_by_caller);
+ struct lttng_consumer_local_data *ctx,
+ bool locked_by_caller);
/*
* function to call when we receive a new channel, it receives a
* newly allocated channel, depending on the return code of this
* This is nested OUTSIDE the stream lock.
* This is nested OUTSIDE the consumer_relayd_sock_pair lock.
*/
- pthread_mutex_t lock {};
+ pthread_mutex_t lock{};
/*
* Number of streams in the data stream hash table declared outside.
LTTNG_EXPORT extern int data_consumption_paused;
/* Return a human-readable consumer type string that is suitable for logging. */
-static inline
-const char *lttng_consumer_type_str(enum lttng_consumer_type type)
+static inline const char *lttng_consumer_type_str(enum lttng_consumer_type type)
{
switch (type) {
case LTTNG_CONSUMER_UNKNOWN:
/*
* Set the error socket for communication with a session daemon.
*/
-void lttng_consumer_set_error_sock(struct lttng_consumer_local_data *ctx,
- int sock);
+void lttng_consumer_set_error_sock(struct lttng_consumer_local_data *ctx, int sock);
/*
* Set the command socket path for communication with a session daemon.
*/
-void lttng_consumer_set_command_sock_path(
- struct lttng_consumer_local_data *ctx, char *sock);
+void lttng_consumer_set_command_sock_path(struct lttng_consumer_local_data *ctx, char *sock);
/*
* Send return code to session daemon.
* Copy the fields from the channel that need to be accessed (read-only)
* directly from the stream.
*/
-void consumer_stream_update_channel_attributes(
- struct lttng_consumer_stream *stream,
- struct lttng_consumer_channel *channel);
-
-struct lttng_consumer_stream *consumer_allocate_stream(
- struct lttng_consumer_channel *channel,
- uint64_t channel_key,
- uint64_t stream_key,
- const char *channel_name,
- uint64_t relayd_id,
- uint64_t session_id,
- struct lttng_trace_chunk *trace_chunk,
- int cpu,
- int *alloc_ret,
- enum consumer_channel_type type,
- unsigned int monitor);
+void consumer_stream_update_channel_attributes(struct lttng_consumer_stream *stream,
+ struct lttng_consumer_channel *channel);
+
+struct lttng_consumer_stream *consumer_allocate_stream(struct lttng_consumer_channel *channel,
+ uint64_t channel_key,
+ uint64_t stream_key,
+ const char *channel_name,
+ uint64_t relayd_id,
+ uint64_t session_id,
+ struct lttng_trace_chunk *trace_chunk,
+ int cpu,
+ int *alloc_ret,
+ enum consumer_channel_type type,
+ unsigned int monitor);
struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
- uint64_t session_id,
- const uint64_t *chunk_id,
- const char *pathname,
- const char *name,
- uint64_t relayd_id,
- enum lttng_event_output output,
- uint64_t tracefile_size,
- uint64_t tracefile_count,
- uint64_t session_id_per_pid,
- unsigned int monitor,
- unsigned int live_timer_interval,
- bool is_in_live_session,
- const char *root_shm_path,
- const char *shm_path);
-void consumer_del_stream(struct lttng_consumer_stream *stream,
- struct lttng_ht *ht);
-void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
- struct lttng_ht *ht);
+ uint64_t session_id,
+ const uint64_t *chunk_id,
+ const char *pathname,
+ const char *name,
+ uint64_t relayd_id,
+ enum lttng_event_output output,
+ uint64_t tracefile_size,
+ uint64_t tracefile_count,
+ uint64_t session_id_per_pid,
+ unsigned int monitor,
+ unsigned int live_timer_interval,
+ bool is_in_live_session,
+ const char *root_shm_path,
+ const char *shm_path);
+void consumer_del_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht);
+void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht);
int consumer_add_channel(struct lttng_consumer_channel *channel,
- struct lttng_consumer_local_data *ctx);
+ struct lttng_consumer_local_data *ctx);
void consumer_del_channel(struct lttng_consumer_channel *channel);
/* lttng-relayd consumer command */
int consumer_send_relayd_streams_sent(uint64_t net_seq_idx);
void close_relayd_stream(struct lttng_consumer_stream *stream);
struct lttng_consumer_channel *consumer_find_channel(uint64_t key);
-int consumer_handle_stream_before_relayd(struct lttng_consumer_stream *stream,
- size_t data_size);
+int consumer_handle_stream_before_relayd(struct lttng_consumer_stream *stream, size_t data_size);
void consumer_steal_stream_key(int key, struct lttng_ht *ht);
-struct lttng_consumer_local_data *lttng_consumer_create(
- enum lttng_consumer_type type,
- ssize_t (*buffer_ready)(struct lttng_consumer_stream *stream,
- struct lttng_consumer_local_data *ctx,
- bool locked_by_caller),
- int (*recv_channel)(struct lttng_consumer_channel *channel),
- int (*recv_stream)(struct lttng_consumer_stream *stream),
- int (*update_stream)(uint64_t sessiond_key, uint32_t state));
+struct lttng_consumer_local_data *
+lttng_consumer_create(enum lttng_consumer_type type,
+ ssize_t (*buffer_ready)(struct lttng_consumer_stream *stream,
+ struct lttng_consumer_local_data *ctx,
+ bool locked_by_caller),
+ int (*recv_channel)(struct lttng_consumer_channel *channel),
+ int (*recv_stream)(struct lttng_consumer_stream *stream),
+ int (*update_stream)(uint64_t sessiond_key, uint32_t state));
void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx);
-ssize_t lttng_consumer_on_read_subbuffer_mmap(
- struct lttng_consumer_stream *stream,
- const struct lttng_buffer_view *buffer,
- unsigned long padding);
-ssize_t lttng_consumer_on_read_subbuffer_splice(
- struct lttng_consumer_local_data *ctx,
- struct lttng_consumer_stream *stream, unsigned long len,
- unsigned long padding);
+ssize_t lttng_consumer_on_read_subbuffer_mmap(struct lttng_consumer_stream *stream,
+ const struct lttng_buffer_view *buffer,
+ unsigned long padding);
+ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data *ctx,
+ struct lttng_consumer_stream *stream,
+ unsigned long len,
+ unsigned long padding);
int lttng_consumer_sample_snapshot_positions(struct lttng_consumer_stream *stream);
int lttng_consumer_take_snapshot(struct lttng_consumer_stream *stream);
-int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
- unsigned long *pos);
-int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
- unsigned long *pos);
+int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos);
+int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos);
int lttng_ustconsumer_get_wakeup_fd(struct lttng_consumer_stream *stream);
int lttng_ustconsumer_close_wakeup_fd(struct lttng_consumer_stream *stream);
void *consumer_thread_metadata_poll(void *data);
void *consumer_thread_sessiond_poll(void *data);
void *consumer_thread_channel_poll(void *data);
int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx,
- int sock, struct pollfd *consumer_sockpoll);
+ int sock,
+ struct pollfd *consumer_sockpoll);
ssize_t lttng_consumer_read_subbuffer(struct lttng_consumer_stream *stream,
- struct lttng_consumer_local_data *ctx,
- bool locked_by_caller);
+ struct lttng_consumer_local_data *ctx,
+ bool locked_by_caller);
int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream);
void consumer_add_relayd_socket(uint64_t net_seq_idx,
- int sock_type,
- struct lttng_consumer_local_data *ctx,
- int sock,
- struct pollfd *consumer_sockpoll,
- uint64_t sessiond_id,
- uint64_t relayd_session_id,
- uint32_t relayd_version_major,
- uint32_t relayd_version_minor,
- enum lttcomm_sock_proto relayd_socket_protocol);
-void consumer_flag_relayd_for_destroy(
- struct consumer_relayd_sock_pair *relayd);
+ int sock_type,
+ struct lttng_consumer_local_data *ctx,
+ int sock,
+ struct pollfd *consumer_sockpoll,
+ uint64_t sessiond_id,
+ uint64_t relayd_session_id,
+ uint32_t relayd_version_major,
+ uint32_t relayd_version_minor,
+ enum lttcomm_sock_proto relayd_socket_protocol);
+void consumer_flag_relayd_for_destroy(struct consumer_relayd_sock_pair *relayd);
int consumer_data_pending(uint64_t id);
int consumer_send_status_msg(int sock, int ret_code);
-int consumer_send_status_channel(int sock,
- struct lttng_consumer_channel *channel);
-void notify_thread_del_channel(struct lttng_consumer_local_data *ctx,
- uint64_t key);
+int consumer_send_status_channel(int sock, struct lttng_consumer_channel *channel);
+void notify_thread_del_channel(struct lttng_consumer_local_data *ctx, uint64_t key);
void consumer_destroy_relayd(struct consumer_relayd_sock_pair *relayd);
unsigned long consumer_get_consume_start_pos(unsigned long consumed_pos,
- unsigned long produced_pos, uint64_t nb_packets_per_stream,
- uint64_t max_sb_size);
+ unsigned long produced_pos,
+ uint64_t nb_packets_per_stream,
+ uint64_t max_sb_size);
void consumer_add_data_stream(struct lttng_consumer_stream *stream);
void consumer_del_stream_for_data(struct lttng_consumer_stream *stream);
void consumer_add_metadata_stream(struct lttng_consumer_stream *stream);
void consumer_del_stream_for_metadata(struct lttng_consumer_stream *stream);
int consumer_create_index_file(struct lttng_consumer_stream *stream);
int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
- uint64_t key, uint64_t relayd_id);
+ uint64_t key,
+ uint64_t relayd_id);
int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream);
int lttng_consumer_rotate_stream(struct lttng_consumer_stream *stream);
-int lttng_consumer_rotate_ready_streams(struct lttng_consumer_channel *channel,
- uint64_t key);
+int lttng_consumer_rotate_ready_streams(struct lttng_consumer_channel *channel, uint64_t key);
void lttng_consumer_reset_stream_rotate_state(struct lttng_consumer_stream *stream);
-enum lttcomm_return_code lttng_consumer_create_trace_chunk(
- const uint64_t *relayd_id, uint64_t session_id,
- uint64_t chunk_id,
- time_t chunk_creation_timestamp,
- const char *chunk_override_name,
- const struct lttng_credentials *credentials,
- struct lttng_directory_handle *chunk_directory_handle);
-enum lttcomm_return_code lttng_consumer_close_trace_chunk(
- const uint64_t *relayd_id, uint64_t session_id,
- uint64_t chunk_id, time_t chunk_close_timestamp,
- const enum lttng_trace_chunk_command_type *close_command,
- char *path);
-enum lttcomm_return_code lttng_consumer_trace_chunk_exists(
- const uint64_t *relayd_id, uint64_t session_id,
- uint64_t chunk_id);
+enum lttcomm_return_code
+lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
+ uint64_t session_id,
+ uint64_t chunk_id,
+ time_t chunk_creation_timestamp,
+ const char *chunk_override_name,
+ const struct lttng_credentials *credentials,
+ struct lttng_directory_handle *chunk_directory_handle);
+enum lttcomm_return_code
+lttng_consumer_close_trace_chunk(const uint64_t *relayd_id,
+ uint64_t session_id,
+ uint64_t chunk_id,
+ time_t chunk_close_timestamp,
+ const enum lttng_trace_chunk_command_type *close_command,
+ char *path);
+enum lttcomm_return_code lttng_consumer_trace_chunk_exists(const uint64_t *relayd_id,
+ uint64_t session_id,
+ uint64_t chunk_id);
void lttng_consumer_cleanup_relayd(struct consumer_relayd_sock_pair *relayd);
-enum lttcomm_return_code lttng_consumer_init_command(
- struct lttng_consumer_local_data *ctx,
- const lttng_uuid& sessiond_uuid);
+enum lttcomm_return_code lttng_consumer_init_command(struct lttng_consumer_local_data *ctx,
+ const lttng_uuid& sessiond_uuid);
int lttng_consumer_clear_channel(struct lttng_consumer_channel *channel);
-enum lttcomm_return_code lttng_consumer_open_channel_packets(
- struct lttng_consumer_channel *channel);
+enum lttcomm_return_code
+lttng_consumer_open_channel_packets(struct lttng_consumer_channel *channel);
int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel);
void lttng_consumer_sigbus_handle(void *addr);
void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel);
METADATA_BUCKET_STATUS_ERROR,
};
-struct metadata_bucket *metadata_bucket_create(
- metadata_bucket_flush_cb flush, void *data);
+struct metadata_bucket *metadata_bucket_create(metadata_bucket_flush_cb flush, void *data);
void metadata_bucket_destroy(struct metadata_bucket *bucket);
enum metadata_bucket_status metadata_bucket_fill(struct metadata_bucket *bucket,
- const struct stream_subbuffer *buffer);
+ const struct stream_subbuffer *buffer);
void metadata_bucket_reset(struct metadata_bucket *bucket);
* Returns 0 if the string is a valid application context, else a negative
* value on error.
*/
-int parse_application_context(const char *str, char **provider_name,
- char **ctx_name);
+int parse_application_context(const char *str, char **provider_name, char **ctx_name);
#endif /* LTTNG_COMMON_CONTEXT_H */
#ifndef LTTNG_CREDENTIALS_H
#define LTTNG_CREDENTIALS_H
-#include <sys/types.h>
-#include <stdbool.h>
#include "macros.hpp"
-
#include "optional.hpp"
+#include <stdbool.h>
+#include <sys/types.h>
+
struct lttng_credentials {
LTTNG_OPTIONAL(uid_t) uid;
LTTNG_OPTIONAL(gid_t) gid;
gid_t lttng_credentials_get_gid(const struct lttng_credentials *creds);
bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a,
- const struct lttng_credentials *b);
+ const struct lttng_credentials *b);
bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a,
- const struct lttng_credentials *b);
+ const struct lttng_credentials *b);
bool lttng_credentials_is_equal(const struct lttng_credentials *a,
- const struct lttng_credentials *b);
+ const struct lttng_credentials *b);
#endif /* LTTNG_CREDENTIALS_H */
*
*/
-#include <unistd.h>
#include <common/macros.hpp>
+#include <unistd.h>
+
/*
* Daemonize this process by forking and making the parent wait for the child
* to signal it indicating readiness. Once received, the parent successfully
*
* Return 0 on success else -1 on error.
*/
-int lttng_daemonize(pid_t *child_ppid, int *completion_flag,
- int close_fds);
+int lttng_daemonize(pid_t *child_ppid, int *completion_flag, int close_fds);
#endif /* LTTNG_DAEMONIZE_H */
#ifndef _DEFAULTS_H
#define _DEFAULTS_H
-#include <pthread.h>
#include <common/macros.hpp>
+#include <pthread.h>
+
/* Default unix group name for tracing. */
-#define DEFAULT_TRACING_GROUP "tracing"
+#define DEFAULT_TRACING_GROUP "tracing"
/*
* This value is defined in the CTF specification (see
* git://git.efficios.com/ctf.git in the file
* common-trace-format-specification.txt.
*/
-#define DEFAULT_METADATA_NAME "metadata"
+#define DEFAULT_METADATA_NAME "metadata"
/* Environment variable to set session daemon binary path. */
-#define DEFAULT_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH"
+#define DEFAULT_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH"
/* Environment variable to set man pager binary path. */
-#define DEFAULT_MAN_BIN_PATH_ENV "LTTNG_MAN_BIN_PATH"
+#define DEFAULT_MAN_BIN_PATH_ENV "LTTNG_MAN_BIN_PATH"
/* Default man pager binary path. */
-#define DEFAULT_MAN_BIN_PATH "/usr/bin/man"
+#define DEFAULT_MAN_BIN_PATH "/usr/bin/man"
/* Default trace output directory name */
-#define DEFAULT_TRACE_DIR_NAME "lttng-traces"
+#define DEFAULT_TRACE_DIR_NAME "lttng-traces"
/* Default size of a hash table */
-#define DEFAULT_HT_SIZE 4
+#define DEFAULT_HT_SIZE 4
/* Default session daemon paths */
-#define DEFAULT_HOME_DIR "/tmp"
-#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks"
-#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global"
-#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng"
+#define DEFAULT_HOME_DIR "/tmp"
+#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks"
+#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global"
+#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng"
/* Default directory where the trace are written in per domain */
-#define DEFAULT_KERNEL_TRACE_DIR "kernel"
-#define DEFAULT_UST_TRACE_DIR "ust"
+#define DEFAULT_KERNEL_TRACE_DIR "kernel"
+#define DEFAULT_UST_TRACE_DIR "ust"
/* Subpath for per PID or UID sessions. */
-#define DEFAULT_UST_TRACE_PID_PATH "pid"
-#define DEFAULT_UST_TRACE_UID_PATH "uid/%d/%u-bit"
+#define DEFAULT_UST_TRACE_PID_PATH "pid"
+#define DEFAULT_UST_TRACE_UID_PATH "uid/%d/%u-bit"
/*
* Default session name for the lttng command line. This default value will
* get the date and time appended (%Y%m%d-%H%M%S) to it.
*/
-#define DEFAULT_SESSION_NAME "auto"
+#define DEFAULT_SESSION_NAME "auto"
/* Default consumer paths */
-#define DEFAULT_CONSUMERD_FILE "lttng-consumerd"
+#define DEFAULT_CONSUMERD_FILE "lttng-consumerd"
/* Default consumer paths */
-#define DEFAULT_CONSUMERD_RUNDIR "%s"
+#define DEFAULT_CONSUMERD_RUNDIR "%s"
/* Kernel consumer path */
-#define DEFAULT_KCONSUMERD_PATH DEFAULT_CONSUMERD_RUNDIR "/kconsumerd"
-#define DEFAULT_KCONSUMERD_CMD_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/command"
-#define DEFAULT_KCONSUMERD_ERR_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/error"
+#define DEFAULT_KCONSUMERD_PATH DEFAULT_CONSUMERD_RUNDIR "/kconsumerd"
+#define DEFAULT_KCONSUMERD_CMD_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/command"
+#define DEFAULT_KCONSUMERD_ERR_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/error"
/* UST 64-bit consumer path */
-#define DEFAULT_USTCONSUMERD64_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd64"
-#define DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/command"
-#define DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/error"
+#define DEFAULT_USTCONSUMERD64_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd64"
+#define DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/command"
+#define DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/error"
/* UST 32-bit consumer path */
-#define DEFAULT_USTCONSUMERD32_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd32"
-#define DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/command"
-#define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/error"
+#define DEFAULT_USTCONSUMERD32_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd32"
+#define DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/command"
+#define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/error"
/* Relayd path */
-#define DEFAULT_RELAYD_RUNDIR "%s"
-#define DEFAULT_RELAYD_PATH DEFAULT_RELAYD_RUNDIR "/relayd"
+#define DEFAULT_RELAYD_RUNDIR "%s"
+#define DEFAULT_RELAYD_PATH DEFAULT_RELAYD_RUNDIR "/relayd"
-#define DEFAULT_RELAYD_MIN_FD_POOL_SIZE 100
+#define DEFAULT_RELAYD_MIN_FD_POOL_SIZE 100
/*
* The file descriptor pool size needs a reserve buffer to accommodates the
* indirect use of short-lived file descriptors. For instance, glibc will
*
* This value must be less than DEFAULT_RELAYD_MIN_FD_POOL_SIZE.
*/
-#define DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE 10
+#define DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE 10
/* Default lttng run directory */
-#define DEFAULT_LTTNG_HOME_ENV_VAR "LTTNG_HOME"
-#define DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR "HOME"
-#define DEFAULT_LTTNG_RUNDIR CONFIG_LTTNG_SYSTEM_RUNDIR
-#define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng"
-#define DEFAULT_LTTNG_SESSIOND_PIDFILE "lttng-sessiond.pid"
-#define DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE "agent.port"
-#define DEFAULT_LTTNG_SESSIOND_LOCKFILE "lttng-sessiond.lck"
+#define DEFAULT_LTTNG_HOME_ENV_VAR "LTTNG_HOME"
+#define DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR "HOME"
+#define DEFAULT_LTTNG_RUNDIR CONFIG_LTTNG_SYSTEM_RUNDIR
+#define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng"
+#define DEFAULT_LTTNG_SESSIOND_PIDFILE "lttng-sessiond.pid"
+#define DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE "agent.port"
+#define DEFAULT_LTTNG_SESSIOND_LOCKFILE "lttng-sessiond.lck"
/* Default probes list */
-#define DEFAULT_LTTNG_KMOD_PROBES "LTTNG_KMOD_PROBES"
+#define DEFAULT_LTTNG_KMOD_PROBES "LTTNG_KMOD_PROBES"
/* Default extra probes list */
-#define DEFAULT_LTTNG_EXTRA_KMOD_PROBES "LTTNG_EXTRA_KMOD_PROBES"
+#define DEFAULT_LTTNG_EXTRA_KMOD_PROBES "LTTNG_EXTRA_KMOD_PROBES"
/* Default unix socket path */
-#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond"
-#define DEFAULT_HOME_CLIENT_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond"
-#define DEFAULT_GLOBAL_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-health"
-#define DEFAULT_HOME_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-health"
-#define DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-notification"
-#define DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-notification"
+#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond"
+#define DEFAULT_HOME_CLIENT_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond"
+#define DEFAULT_GLOBAL_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-health"
+#define DEFAULT_HOME_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-health"
+#define DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-notification"
+#define DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK \
+ DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-notification"
/* Default consumer health unix socket path */
-#define DEFAULT_GLOBAL_USTCONSUMER32_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd32/health"
-#define DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd32/health"
-#define DEFAULT_GLOBAL_USTCONSUMER64_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd64/health"
-#define DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd64/health"
-#define DEFAULT_GLOBAL_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/kconsumerd/health"
-#define DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/kconsumerd/health"
+#define DEFAULT_GLOBAL_USTCONSUMER32_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd32/health"
+#define DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK \
+ DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd32/health"
+#define DEFAULT_GLOBAL_USTCONSUMER64_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd64/health"
+#define DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK \
+ DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd64/health"
+#define DEFAULT_GLOBAL_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/kconsumerd/health"
+#define DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/kconsumerd/health"
/* Default relay health unix socket path */
-#define DEFAULT_GLOBAL_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/relayd/health-%d"
-#define DEFAULT_HOME_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/relayd/health-%d"
+#define DEFAULT_GLOBAL_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/relayd/health-%d"
+#define DEFAULT_HOME_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/relayd/health-%d"
/* Default daemon configuration file path */
-#define DEFAULT_SYSTEM_CONFIGPATH CONFIG_LTTNG_SYSTEM_CONFIGDIR \
+#define DEFAULT_SYSTEM_CONFIGPATH \
+ CONFIG_LTTNG_SYSTEM_CONFIGDIR \
"/lttng"
-#define DEFAULT_DAEMON_CONFIG_FILE "lttng.conf"
-#define DEFAULT_DAEMON_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" \
- DEFAULT_DAEMON_CONFIG_FILE
-#define DEFAULT_DAEMON_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" \
- DEFAULT_DAEMON_CONFIG_FILE
+#define DEFAULT_DAEMON_CONFIG_FILE "lttng.conf"
+#define DEFAULT_DAEMON_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" DEFAULT_DAEMON_CONFIG_FILE
+#define DEFAULT_DAEMON_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" DEFAULT_DAEMON_CONFIG_FILE
/* Default session configuration file path */
-#define DEFAULT_SESSION_PATH "sessions"
+#define DEFAULT_SESSION_PATH "sessions"
/* Auto load session in that directory. */
-#define DEFAULT_SESSION_CONFIG_AUTOLOAD "auto"
-#define DEFAULT_SESSION_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" \
- DEFAULT_SESSION_PATH
-#define DEFAULT_SESSION_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" \
- DEFAULT_SESSION_PATH
-#define DEFAULT_SESSION_CONFIG_FILE_EXTENSION ".lttng"
-#define DEFAULT_SESSION_CONFIG_XSD_FILENAME "session.xsd"
-#define DEFAULT_SESSION_CONFIG_XSD_PATH CONFIG_LTTNG_SYSTEM_DATADIR "/xml/lttng/"
-#define DEFAULT_SESSION_CONFIG_XSD_PATH_ENV "LTTNG_SESSION_CONFIG_XSD_PATH"
-
-#define DEFAULT_GLOBAL_APPS_UNIX_SOCK \
- DEFAULT_LTTNG_RUNDIR "/" LTTNG_UST_SOCK_FILENAME
-#define DEFAULT_HOME_APPS_UNIX_SOCK \
- DEFAULT_LTTNG_HOME_RUNDIR "/" LTTNG_UST_SOCK_FILENAME
-#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH \
- "/" LTTNG_UST_WAIT_FILENAME
-#define DEFAULT_HOME_APPS_WAIT_SHM_PATH \
- DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "-%d"
+#define DEFAULT_SESSION_CONFIG_AUTOLOAD "auto"
+#define DEFAULT_SESSION_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" DEFAULT_SESSION_PATH
+#define DEFAULT_SESSION_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" DEFAULT_SESSION_PATH
+#define DEFAULT_SESSION_CONFIG_FILE_EXTENSION ".lttng"
+#define DEFAULT_SESSION_CONFIG_XSD_FILENAME "session.xsd"
+#define DEFAULT_SESSION_CONFIG_XSD_PATH CONFIG_LTTNG_SYSTEM_DATADIR "/xml/lttng/"
+#define DEFAULT_SESSION_CONFIG_XSD_PATH_ENV "LTTNG_SESSION_CONFIG_XSD_PATH"
+
+#define DEFAULT_GLOBAL_APPS_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/" LTTNG_UST_SOCK_FILENAME
+#define DEFAULT_HOME_APPS_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/" LTTNG_UST_SOCK_FILENAME
+#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "/" LTTNG_UST_WAIT_FILENAME
+#define DEFAULT_HOME_APPS_WAIT_SHM_PATH DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "-%d"
/*
* Value taken from the hard limit allowed by the kernel when using setrlimit
#define DEFAULT_STREAM_NAME_LEN (LTTNG_SYMBOL_NAME_LEN + 8)
/* Default channel attributes */
-#define DEFAULT_CHANNEL_NAME "channel0"
+#define DEFAULT_CHANNEL_NAME "channel0"
/* Default JUL domain channel name. */
-#define DEFAULT_JUL_CHANNEL_NAME "lttng_jul_channel"
+#define DEFAULT_JUL_CHANNEL_NAME "lttng_jul_channel"
/* Default JUL tracepoint name. This is a wildcard for the JUL domain. */
-#define DEFAULT_JUL_EVENT_COMPONENT "lttng_jul"
-#define DEFAULT_JUL_EVENT_NAME DEFAULT_JUL_EVENT_COMPONENT ":*"
+#define DEFAULT_JUL_EVENT_COMPONENT "lttng_jul"
+#define DEFAULT_JUL_EVENT_NAME DEFAULT_JUL_EVENT_COMPONENT ":*"
/* Default log4j domain channel name. */
-#define DEFAULT_LOG4J_CHANNEL_NAME "lttng_log4j_channel"
+#define DEFAULT_LOG4J_CHANNEL_NAME "lttng_log4j_channel"
/* Default log4j tracepoint name. This is a wildcard for the log4j domain. */
-#define DEFAULT_LOG4J_EVENT_COMPONENT "lttng_log4j"
-#define DEFAULT_LOG4J_EVENT_NAME DEFAULT_LOG4J_EVENT_COMPONENT ":*"
+#define DEFAULT_LOG4J_EVENT_COMPONENT "lttng_log4j"
+#define DEFAULT_LOG4J_EVENT_NAME DEFAULT_LOG4J_EVENT_COMPONENT ":*"
/* Default Python domain channel name. */
-#define DEFAULT_PYTHON_CHANNEL_NAME "lttng_python_channel"
+#define DEFAULT_PYTHON_CHANNEL_NAME "lttng_python_channel"
/* Default Python tracepoint name. This is a wildcard for the python domain. */
-#define DEFAULT_PYTHON_EVENT_COMPONENT "lttng_python"
-#define DEFAULT_PYTHON_EVENT_NAME DEFAULT_PYTHON_EVENT_COMPONENT ":*"
+#define DEFAULT_PYTHON_EVENT_COMPONENT "lttng_python"
+#define DEFAULT_PYTHON_EVENT_NAME DEFAULT_PYTHON_EVENT_COMPONENT ":*"
#define DEFAULT_CHANNEL_OVERWRITE (-1)
-#define DEFAULT_CHANNEL_TRACEFILE_SIZE CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE
+#define DEFAULT_CHANNEL_TRACEFILE_SIZE CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE
#define DEFAULT_CHANNEL_TRACEFILE_COUNT CONFIG_DEFAULT_CHANNEL_TRACEFILE_COUNT
-#define _DEFAULT_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_CHANNEL_SUBBUF_SIZE
-#define _DEFAULT_CHANNEL_OUTPUT LTTNG_EVENT_MMAP
+#define _DEFAULT_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_CHANNEL_SUBBUF_SIZE
+#define _DEFAULT_CHANNEL_OUTPUT LTTNG_EVENT_MMAP
/* Metadata channel defaults. */
-#define DEFAULT_METADATA_SUBBUF_SIZE CONFIG_DEFAULT_METADATA_SUBBUF_SIZE
-#define DEFAULT_METADATA_SUBBUF_NUM CONFIG_DEFAULT_METADATA_SUBBUF_NUM
-#define DEFAULT_METADATA_CACHE_SIZE CONFIG_DEFAULT_METADATA_CACHE_SIZE
-#define DEFAULT_METADATA_SWITCH_TIMER 0
-#define DEFAULT_METADATA_READ_TIMER 0
-#define DEFAULT_METADATA_OVERWRITE 0
-#define DEFAULT_METADATA_OUTPUT LTTNG_EVENT_MMAP
+#define DEFAULT_METADATA_SUBBUF_SIZE CONFIG_DEFAULT_METADATA_SUBBUF_SIZE
+#define DEFAULT_METADATA_SUBBUF_NUM CONFIG_DEFAULT_METADATA_SUBBUF_NUM
+#define DEFAULT_METADATA_CACHE_SIZE CONFIG_DEFAULT_METADATA_CACHE_SIZE
+#define DEFAULT_METADATA_SWITCH_TIMER 0
+#define DEFAULT_METADATA_READ_TIMER 0
+#define DEFAULT_METADATA_OVERWRITE 0
+#define DEFAULT_METADATA_OUTPUT LTTNG_EVENT_MMAP
/* Kernel has different defaults */
/* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */
-#define DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE
+#define DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE
/*
* DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM must always be a power of 2.
* Update help manually if override.
*/
-#define DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM
+#define DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM
/* See lttng-kernel.h enum lttng_kernel_output for channel output */
-#define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE
+#define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE
#define DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER
#define DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER
#define DEFAULT_KERNEL_CHANNEL_READ_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_READ_TIMER
#define DEFAULT_KERNEL_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_LIVE_TIMER
-#define DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT
+#define DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT
/* User space defaults */
/* Must be a power of 2 */
-#define DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE
-#define DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE
+#define DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE
+#define DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE
/* Must be a power of 2. Update help manuall if override. */
-#define DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM
-#define DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM
+#define DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM
+#define DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM
/* See lttng-ust.h enum lttng_ust_output */
-#define DEFAULT_UST_PID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT
-#define DEFAULT_UST_UID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT
+#define DEFAULT_UST_PID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT
+#define DEFAULT_UST_UID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT
/* Timers in usec. */
-#define DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER
-#define DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER
-#define DEFAULT_UST_PID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_LIVE_TIMER
-#define DEFAULT_UST_UID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_LIVE_TIMER
-#define DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER
-#define DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER
+#define DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER
+#define DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER
+#define DEFAULT_UST_PID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_LIVE_TIMER
+#define DEFAULT_UST_UID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_LIVE_TIMER
+#define DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER
+#define DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER
-#define DEFAULT_UST_PID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_READ_TIMER
-#define DEFAULT_UST_UID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_READ_TIMER
+#define DEFAULT_UST_PID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_READ_TIMER
+#define DEFAULT_UST_UID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_READ_TIMER
-#define DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT
-#define DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT
+#define DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT
+#define DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT
/*
* Default timeout value for the sem_timedwait() call. Blocking forever is not
* wanted so a timeout is used to control the data flow and not freeze the
* session daemon.
*/
-#define DEFAULT_SEM_WAIT_TIMEOUT 30 /* in seconds */
+#define DEFAULT_SEM_WAIT_TIMEOUT 30 /* in seconds */
/* Default bind addresses for network services. */
-#define DEFAULT_NETWORK_CONTROL_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_CONTROL_BIND_ADDRESS
-#define DEFAULT_NETWORK_DATA_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_DATA_BIND_ADDRESS
-#define DEFAULT_NETWORK_VIEWER_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_VIEWER_BIND_ADDRESS
-#define DEFAULT_AGENT_BIND_ADDRESS CONFIG_DEFAULT_AGENT_BIND_ADDRESS
+#define DEFAULT_NETWORK_CONTROL_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_CONTROL_BIND_ADDRESS
+#define DEFAULT_NETWORK_DATA_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_DATA_BIND_ADDRESS
+#define DEFAULT_NETWORK_VIEWER_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_VIEWER_BIND_ADDRESS
+#define DEFAULT_AGENT_BIND_ADDRESS CONFIG_DEFAULT_AGENT_BIND_ADDRESS
/* Default network ports for trace streaming support. */
-#define DEFAULT_NETWORK_CONTROL_PORT CONFIG_DEFAULT_NETWORK_CONTROL_PORT
-#define DEFAULT_NETWORK_DATA_PORT CONFIG_DEFAULT_NETWORK_DATA_PORT
-#define DEFAULT_NETWORK_VIEWER_PORT CONFIG_DEFAULT_NETWORK_VIEWER_PORT
+#define DEFAULT_NETWORK_CONTROL_PORT CONFIG_DEFAULT_NETWORK_CONTROL_PORT
+#define DEFAULT_NETWORK_DATA_PORT CONFIG_DEFAULT_NETWORK_DATA_PORT
+#define DEFAULT_NETWORK_VIEWER_PORT CONFIG_DEFAULT_NETWORK_VIEWER_PORT
/* Agent registration TCP port range. */
-#define DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN
-#define DEFAULT_AGENT_TCP_PORT_RANGE_END CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_END
+#define DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN
+#define DEFAULT_AGENT_TCP_PORT_RANGE_END CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_END
/* Number of buckets in the event notifier error count map. */
-#define DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE CONFIG_DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE
+#define DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE \
+ CONFIG_DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE
/*
* If a thread stalls for this amount of time, it will be considered bogus (bad
* health).
*/
-#define DEFAULT_HEALTH_CHECK_DELTA_S 20
-#define DEFAULT_HEALTH_CHECK_DELTA_NS 0
+#define DEFAULT_HEALTH_CHECK_DELTA_S 20
+#define DEFAULT_HEALTH_CHECK_DELTA_NS 0
/*
* Wait period before retrying the lttng_data_pending command in the lttng
* stop command of liblttng-ctl.
*/
-#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US 200000 /* usec */
+#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US 200000 /* usec */
/*
* Wait period before retrying the lttng_consumer_flushed_cache when
* the consumer receives metadata.
*/
-#define DEFAULT_METADATA_AVAILABILITY_WAIT_TIME 200000 /* usec */
+#define DEFAULT_METADATA_AVAILABILITY_WAIT_TIME 200000 /* usec */
/*
* The usual value for the maximum TCP SYN retries time and TCP FIN timeout is
* 180 and 60 seconds on most Linux system and the default value since kernel
* 2.2 thus using the highest value. See tcp(7) for more details.
*/
-#define DEFAULT_INET_TCP_TIMEOUT 180 /* sec */
+#define DEFAULT_INET_TCP_TIMEOUT 180 /* sec */
/* Maximum payload size for a control connection */
-#define DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE CONFIG_DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE
+#define DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE \
+ CONFIG_DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE
/*
* Default receiving and sending timeout for an application socket.
*/
-#define DEFAULT_APP_SOCKET_RW_TIMEOUT CONFIG_DEFAULT_APP_SOCKET_RW_TIMEOUT
-#define DEFAULT_APP_SOCKET_TIMEOUT_ENV "LTTNG_APP_SOCKET_TIMEOUT"
+#define DEFAULT_APP_SOCKET_RW_TIMEOUT CONFIG_DEFAULT_APP_SOCKET_RW_TIMEOUT
+#define DEFAULT_APP_SOCKET_TIMEOUT_ENV "LTTNG_APP_SOCKET_TIMEOUT"
-#define DEFAULT_UST_STREAM_FD_NUM 2 /* Number of fd per UST stream. */
+#define DEFAULT_UST_STREAM_FD_NUM 2 /* Number of fd per UST stream. */
-#define DEFAULT_SNAPSHOT_NAME "snapshot"
-#define DEFAULT_SNAPSHOT_MAX_SIZE 0 /* Unlimited. */
+#define DEFAULT_SNAPSHOT_NAME "snapshot"
+#define DEFAULT_SNAPSHOT_MAX_SIZE 0 /* Unlimited. */
/* Suffix of an index file. */
-#define DEFAULT_INDEX_FILE_SUFFIX ".idx"
-#define DEFAULT_INDEX_DIR "index"
+#define DEFAULT_INDEX_FILE_SUFFIX ".idx"
+#define DEFAULT_INDEX_DIR "index"
/* Default lttng command live timer value in usec. */
-#define DEFAULT_LTTNG_LIVE_TIMER CONFIG_DEFAULT_LTTNG_LIVE_TIMER
+#define DEFAULT_LTTNG_LIVE_TIMER CONFIG_DEFAULT_LTTNG_LIVE_TIMER
/* Default runas worker name */
-#define DEFAULT_RUN_AS_WORKER_NAME "lttng-runas"
+#define DEFAULT_RUN_AS_WORKER_NAME "lttng-runas"
/* Default LTTng MI XML namespace. */
-#define DEFAULT_LTTNG_MI_NAMESPACE "https://lttng.org/xml/ns/lttng-mi"
+#define DEFAULT_LTTNG_MI_NAMESPACE "https://lttng.org/xml/ns/lttng-mi"
/* Default thread stack size; the default mandated by pthread_create(3) */
-#define DEFAULT_LTTNG_THREAD_STACK_SIZE 2097152
+#define DEFAULT_LTTNG_THREAD_STACK_SIZE 2097152
/* Default maximal size of message notification channel message payloads. */
-#define DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE 65536
+#define DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE 65536
/* Default maximal size of trace archive location. */
-#define DEFAULT_MAX_TRACE_ARCHIVE_LOCATION_PAYLOAD_SIZE 65536
+#define DEFAULT_MAX_TRACE_ARCHIVE_LOCATION_PAYLOAD_SIZE 65536
/* Default maximal size of message notification channel message payloads. */
-#define DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT 100
-
+#define DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT 100
-#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE"
+#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE"
#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME"
-#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT"
-#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL"
-#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD"
+#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV \
+ "LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT"
+#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV \
+ "LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL"
+#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV \
+ "LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD"
#define DEFAULT_LTTNG_RELAYD_DISALLOW_CLEAR_ENV "LTTNG_RELAYD_DISALLOW_CLEAR"
#define DEFAULT_LTTNG_RELAYD_WORKING_DIRECTORY_ENV "LTTNG_RELAYD_WORKING_DIRECTORY"
* Name of the intermediate directory used to rename the trace chunk of a
* session's first rotation.
*/
-#define DEFAULT_CHUNK_TMP_OLD_DIRECTORY ".tmp_old_chunk"
-#define DEFAULT_CHUNK_TMP_NEW_DIRECTORY ".tmp_new_chunk"
-#define DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "archives"
-#define DEFAULT_UNLINKED_FILES_DIRECTORY ".unlinked"
+#define DEFAULT_CHUNK_TMP_OLD_DIRECTORY ".tmp_old_chunk"
+#define DEFAULT_CHUNK_TMP_NEW_DIRECTORY ".tmp_new_chunk"
+#define DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "archives"
+#define DEFAULT_UNLINKED_FILES_DIRECTORY ".unlinked"
/*
* Default timer value in usec for the rotate pending polling check on the
* relay when a rotation has completed on the consumer.
*/
-#define DEFAULT_ROTATE_PENDING_TIMER CONFIG_DEFAULT_ROTATE_PENDING_TIMER
+#define DEFAULT_ROTATE_PENDING_TIMER CONFIG_DEFAULT_ROTATE_PENDING_TIMER
/*
* Returns the default subbuf size.
* allocation and can't fail.
*/
void lttng_dynamic_array_init(struct lttng_dynamic_array *array,
- size_t element_size,
- lttng_dynamic_array_element_destructor destructor);
+ size_t element_size,
+ lttng_dynamic_array_element_destructor destructor);
/*
* Returns the number of elements in the dynamic array.
*/
-static inline
-size_t lttng_dynamic_array_get_count(
- const struct lttng_dynamic_array *array)
+static inline size_t lttng_dynamic_array_get_count(const struct lttng_dynamic_array *array)
{
return array->size;
}
* Returns a pointer to the element. Mutating operations on the array invalidate
* the returned pointer.
*/
-static inline
-void *lttng_dynamic_array_get_element(const struct lttng_dynamic_array *array,
- size_t element_index)
+static inline void *lttng_dynamic_array_get_element(const struct lttng_dynamic_array *array,
+ size_t element_index)
{
LTTNG_ASSERT(element_index < array->size);
return array->buffer.data + (element_index * array->element_size);
* NOTE: It is striclty _invalid_ to access memory after _size_, regardless
* of prior calls to set_capacity().
*/
-int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array,
- size_t new_element_count);
+int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array, size_t new_element_count);
/*
* Add an element to the end of a dynamic array. The array's element count is
*
* element is a pointer to the element to add (copy) to the array.
*/
-int lttng_dynamic_array_add_element(struct lttng_dynamic_array *array,
- const void *element);
+int lttng_dynamic_array_add_element(struct lttng_dynamic_array *array, const void *element);
/*
* Remove an element from the dynamic array. The array's element count is
* decreased by one and the following elements are shifted to take its place
* (when applicable).
*/
-int lttng_dynamic_array_remove_element(struct lttng_dynamic_array *array,
- size_t element_index);
+int lttng_dynamic_array_remove_element(struct lttng_dynamic_array *array, size_t element_index);
/* Release any memory used by the dynamic array. */
void lttng_dynamic_array_reset(struct lttng_dynamic_array *array);
* Initialize a resizable array of fixed-size elements. This performs no
* allocation and can't fail.
*/
-void lttng_dynamic_pointer_array_init(
- struct lttng_dynamic_pointer_array *array,
- lttng_dynamic_pointer_array_destructor destructor);
+void lttng_dynamic_pointer_array_init(struct lttng_dynamic_pointer_array *array,
+ lttng_dynamic_pointer_array_destructor destructor);
/*
* Returns the number of pointers in the dynamic pointer array.
*/
-static inline
-size_t lttng_dynamic_pointer_array_get_count(
- const struct lttng_dynamic_pointer_array *array)
+static inline size_t
+lttng_dynamic_pointer_array_get_count(const struct lttng_dynamic_pointer_array *array)
{
return lttng_dynamic_array_get_count(&array->array);
}
/*
* Returns the pointer at index `index`.
*/
-static inline
-void *lttng_dynamic_pointer_array_get_pointer(
- const struct lttng_dynamic_pointer_array *array, size_t index)
+static inline void *
+lttng_dynamic_pointer_array_get_pointer(const struct lttng_dynamic_pointer_array *array,
+ size_t index)
{
void **element = (void **) lttng_dynamic_array_get_element(&array->array, index);
* run the destructor.
*/
-static inline
-void *lttng_dynamic_pointer_array_steal_pointer(
- struct lttng_dynamic_pointer_array *array, size_t index)
+static inline void *
+lttng_dynamic_pointer_array_steal_pointer(struct lttng_dynamic_pointer_array *array, size_t index)
{
void **p_element = (void **) lttng_dynamic_array_get_element(&array->array, index);
void *element = *p_element;
* count is increased by one and its underlying capacity is adjusted
* automatically.
*/
-static inline
-int lttng_dynamic_pointer_array_add_pointer(
- struct lttng_dynamic_pointer_array *array, void *pointer)
+static inline int lttng_dynamic_pointer_array_add_pointer(struct lttng_dynamic_pointer_array *array,
+ void *pointer)
{
return lttng_dynamic_array_add_element(&array->array, &pointer);
}
* count is decreased by one and the following pointers are shifted to
* take the place of the removed pointer (if applicable).
*/
-int lttng_dynamic_pointer_array_remove_pointer(
- struct lttng_dynamic_pointer_array *array, size_t index);
+int lttng_dynamic_pointer_array_remove_pointer(struct lttng_dynamic_pointer_array *array,
+ size_t index);
/* Release any memory used by the dynamic array. */
-void lttng_dynamic_pointer_array_reset(
- struct lttng_dynamic_pointer_array *array);
+void lttng_dynamic_pointer_array_reset(struct lttng_dynamic_pointer_array *array);
/* Remove all elements from the dynamic pointer array. */
-void lttng_dynamic_pointer_array_clear(
- struct lttng_dynamic_pointer_array *array);
+void lttng_dynamic_pointer_array_clear(struct lttng_dynamic_pointer_array *array);
#endif /* LTTNG_DYNAMIC_ARRAY_H */
#ifndef LTTNG_DYNAMIC_BUFFER_H
#define LTTNG_DYNAMIC_BUFFER_H
+#include <common/macros.hpp>
+
#include <stddef.h>
#include <stdint.h>
-#include <common/macros.hpp>
struct lttng_buffer_view;
* (after its current "size"). The dynamic buffer's size is increased by
* "len", and its capacity is adjusted automatically.
*/
-int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer,
- const void *buf, size_t len);
+int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer, const void *buf, size_t len);
/*
* Performs the same action as lttng_dynamic_buffer_append(), but using another
* of "len".
*/
int lttng_dynamic_buffer_append_buffer(struct lttng_dynamic_buffer *dst_buffer,
- const struct lttng_dynamic_buffer *src_buffer);
+ const struct lttng_dynamic_buffer *src_buffer);
/*
* Performs the same action as lttng_dynamic_buffer_append(), but using a
* of "len".
*/
int lttng_dynamic_buffer_append_view(struct lttng_dynamic_buffer *buffer,
- const struct lttng_buffer_view *view);
+ const struct lttng_buffer_view *view);
/*
* Set the buffer's size to new_size. The capacity of the buffer will
* NOTE: It is striclty _invalid_ to access memory after _size_, regardless
* of prior calls to set_capacity().
*/
-int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
- size_t new_size);
+int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer, size_t new_size);
/*
* Set the buffer's capacity to accommodates the new_capacity, allocating memory
*
* If the current size > new_capacity, the operation will fail.
*/
-int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
- size_t new_capacity);
+int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer, size_t new_capacity);
/* Release any memory used by the dynamic buffer. */
void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer);
/* Get the space left in the buffer before a new resize is needed. */
-size_t lttng_dynamic_buffer_get_capacity_left(
- struct lttng_dynamic_buffer *buffer);
+size_t lttng_dynamic_buffer_get_capacity_left(struct lttng_dynamic_buffer *buffer);
#endif /* LTTNG_DYNAMIC_BUFFER_H */
#error "lttng-tools error.h needs _GNU_SOURCE"
#endif
-#include <lttng/lttng-error.h>
#include <common/compat/tid.hpp>
+#include <lttng/lttng-error.h>
+
/* Avoid conflict with Solaris <sys/regset.h> */
#if defined(ERR) && defined(__sun__)
#undef ERR
/* Stringify the expansion of a define */
#define XSTR(d) STR(d)
-#define STR(s) #s
+#define STR(s) #s
/*
* Contains the string of the log entry time. This is used as a thread local
/* Format: 00:00:00.000000000 plus NULL byte. */
char str[19];
};
-extern LTTNG_EXPORT 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;
/* Error type. */
enum lttng_error_level {
- PRINT_ERR = 0,
- PRINT_BUG = 1,
- PRINT_WARN = 2,
- PRINT_MSG = 3,
- PRINT_DBG = 4,
- PRINT_DBG2 = 5,
- PRINT_DBG3 = 6,
+ PRINT_ERR = 0,
+ PRINT_BUG = 1,
+ PRINT_WARN = 2,
+ PRINT_MSG = 3,
+ PRINT_DBG = 4,
+ PRINT_DBG2 = 5,
+ PRINT_DBG3 = 6,
};
static inline bool __lttng_print_check_opt(enum lttng_error_level type)
* want any nested msg to show up when printing mi to stdout(if it's the case).
* All warnings and errors should be printed to stderr as normal.
*/
-#define __lttng_print(type, fmt, args...) \
- do { \
- if (__lttng_print_check_opt(type)) { \
- fprintf((type) == PRINT_MSG ? stdout : stderr, fmt, ## args); \
- } \
- __lttng_print_check_abort(type); \
+#define __lttng_print(type, fmt, args...) \
+ do { \
+ if (__lttng_print_check_opt(type)) { \
+ fprintf((type) == PRINT_MSG ? stdout : stderr, fmt, ##args); \
+ } \
+ __lttng_print_check_abort(type); \
} while (0)
/* Three level of debug. Use -v, -vv or -vvv for the levels */
-#define _ERRMSG(msg, type, fmt, args...) \
- do { \
- if (caa_unlikely(__lttng_print_check_opt(type))) { \
- char generic_name[MAX_INT_DEC_LEN(long) + \
- MAX_INT_DEC_LEN(long)]; \
- \
- snprintf(generic_name, sizeof(generic_name), \
- "%ld/%ld", (long) getpid(), \
- (long) lttng_gettid()); \
- \
- __lttng_print(type, \
- msg " - %s [%s]: " fmt \
- " (in %s() at " __FILE__ \
- ":" XSTR(__LINE__) ")\n", \
- log_add_time(), \
- URCU_TLS(logger_thread_name) ?: \
- generic_name, \
- ##args, __func__); \
- } \
+#define _ERRMSG(msg, type, fmt, args...) \
+ do { \
+ if (caa_unlikely(__lttng_print_check_opt(type))) { \
+ char generic_name[MAX_INT_DEC_LEN(long) + MAX_INT_DEC_LEN(long)]; \
+ \
+ snprintf(generic_name, \
+ sizeof(generic_name), \
+ "%ld/%ld", \
+ (long) getpid(), \
+ (long) lttng_gettid()); \
+ \
+ __lttng_print(type, \
+ msg " - %s [%s]: " fmt " (in %s() at " __FILE__ \
+ ":" XSTR(__LINE__) ")\n", \
+ log_add_time(), \
+ URCU_TLS(logger_thread_name) ?: generic_name, \
+ ##args, \
+ __func__); \
+ } \
} while (0)
-#define _ERRMSG_NO_LOC(msg, type, fmt, args...) \
- do { \
- if (caa_unlikely(__lttng_print_check_opt(type))) { \
- char generic_name[MAX_INT_DEC_LEN(long) + \
- MAX_INT_DEC_LEN(long)]; \
- \
- snprintf(generic_name, sizeof(generic_name), \
- "%ld/%ld", (long) getpid(), \
- (long) lttng_gettid()); \
- \
- __lttng_print(type, msg " - %s [%s]: " fmt "\n", \
- log_add_time(), \
- URCU_TLS(logger_thread_name) ?: \
- generic_name, \
- ##args); \
- } \
+#define _ERRMSG_NO_LOC(msg, type, fmt, args...) \
+ do { \
+ if (caa_unlikely(__lttng_print_check_opt(type))) { \
+ char generic_name[MAX_INT_DEC_LEN(long) + MAX_INT_DEC_LEN(long)]; \
+ \
+ snprintf(generic_name, \
+ sizeof(generic_name), \
+ "%ld/%ld", \
+ (long) getpid(), \
+ (long) lttng_gettid()); \
+ \
+ __lttng_print(type, \
+ msg " - %s [%s]: " fmt "\n", \
+ log_add_time(), \
+ URCU_TLS(logger_thread_name) ?: generic_name, \
+ ##args); \
+ } \
} while (0)
-#define MSG(fmt, args...) \
- __lttng_print(PRINT_MSG, fmt "\n", ## args)
-#define _MSG(fmt, args...) \
- __lttng_print(PRINT_MSG, fmt, ## args)
-#define ERR(fmt, args...) \
- __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args)
-#define WARN(fmt, args...) \
- __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args)
+#define MSG(fmt, args...) __lttng_print(PRINT_MSG, fmt "\n", ##args)
+#define _MSG(fmt, args...) __lttng_print(PRINT_MSG, fmt, ##args)
+#define ERR(fmt, args...) __lttng_print(PRINT_ERR, "Error: " fmt "\n", ##args)
+#define WARN(fmt, args...) __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ##args)
-#define BUG(fmt, args...) _ERRMSG("BUG", PRINT_BUG, fmt, ## args)
+#define BUG(fmt, args...) _ERRMSG("BUG", PRINT_BUG, fmt, ##args)
-#define DBG(fmt, args...) _ERRMSG("DBG1", PRINT_DBG, fmt, ## args)
-#define DBG_NO_LOC(fmt, args...) _ERRMSG_NO_LOC("DBG1", PRINT_DBG, fmt, ## args)
-#define DBG2(fmt, args...) _ERRMSG("DBG2", PRINT_DBG2, fmt, ## args)
-#define DBG3(fmt, args...) _ERRMSG("DBG3", PRINT_DBG3, fmt, ## args)
-#define LOG(type, fmt, args...) \
- do { \
- switch (type) { \
- case PRINT_ERR: \
- ERR(fmt, ## args); \
- break; \
- case PRINT_WARN: \
- WARN(fmt, ## args); \
- break; \
- case PRINT_BUG: \
- BUG(fmt, ## args); \
- break; \
- case PRINT_MSG: \
- MSG(fmt, ## args); \
- break; \
- case PRINT_DBG: \
- DBG(fmt, ## args); \
- break; \
- case PRINT_DBG2: \
- DBG2(fmt, ## args); \
- break; \
- case PRINT_DBG3: \
- DBG3(fmt, ## args); \
- break; \
- default: \
- abort(); \
- } \
- } while(0);
+#define DBG(fmt, args...) _ERRMSG("DBG1", PRINT_DBG, fmt, ##args)
+#define DBG_NO_LOC(fmt, args...) _ERRMSG_NO_LOC("DBG1", PRINT_DBG, fmt, ##args)
+#define DBG2(fmt, args...) _ERRMSG("DBG2", PRINT_DBG2, fmt, ##args)
+#define DBG3(fmt, args...) _ERRMSG("DBG3", PRINT_DBG3, fmt, ##args)
+#define LOG(type, fmt, args...) \
+ do { \
+ switch (type) { \
+ case PRINT_ERR: \
+ ERR(fmt, ##args); \
+ break; \
+ case PRINT_WARN: \
+ WARN(fmt, ##args); \
+ break; \
+ case PRINT_BUG: \
+ BUG(fmt, ##args); \
+ break; \
+ case PRINT_MSG: \
+ MSG(fmt, ##args); \
+ break; \
+ case PRINT_DBG: \
+ DBG(fmt, ##args); \
+ break; \
+ case PRINT_DBG2: \
+ DBG2(fmt, ##args); \
+ break; \
+ case PRINT_DBG3: \
+ DBG3(fmt, ##args); \
+ break; \
+ default: \
+ abort(); \
+ } \
+ } while (0);
-#define _PERROR(fmt, args...) _ERRMSG("PERROR", PRINT_ERR, fmt, ## args)
+#define _PERROR(fmt, args...) _ERRMSG("PERROR", PRINT_ERR, fmt, ##args)
-#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
+#if !defined(__GLIBC__) || \
+ ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
/*
* Version using XSI strerror_r.
/*
* Version using GNU strerror_r, for linux with appropriate defines.
*/
-#define PERROR(call, args...) \
- do { \
- char *_perror_buf; \
- char _perror_tmp[200]; \
- _perror_buf = strerror_r( \
- errno, _perror_tmp, sizeof(_perror_tmp)); \
- _PERROR(call ": %s", ##args, _perror_buf); \
+#define PERROR(call, args...) \
+ do { \
+ char *_perror_buf; \
+ char _perror_tmp[200]; \
+ _perror_buf = strerror_r(errno, _perror_tmp, sizeof(_perror_tmp)); \
+ _PERROR(call ": %s", ##args, _perror_buf); \
} while (0);
#endif
serialized_len = len;
/* Append exclusion length, includes the null terminator. */
- ret = lttng_dynamic_buffer_append(&payload->buffer, &serialized_len, sizeof(serialized_len));
+ ret = lttng_dynamic_buffer_append(
+ &payload->buffer, &serialized_len, sizeof(serialized_len));
if (ret) {
goto end;
}
#ifndef LTTNG_EXCEPTION_H_
#define LTTNG_EXCEPTION_H_
-#include <string>
+#include <lttng/lttng-error.h>
+
#include <stdexcept>
+#include <string>
#include <system_error>
-#include <lttng/lttng-error.h>
-
#define LTTNG_THROW_CTL(msg, error_code) \
throw lttng::ctl::error(msg, error_code, __FILE__, __func__, __LINE__)
#define LTTNG_THROW_POSIX(msg, errno_code) \
class runtime_error : public std::runtime_error {
public:
explicit runtime_error(const std::string& msg,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
class unsupported_error : public std::runtime_error {
public:
explicit unsupported_error(const std::string& msg,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
namespace ctl {
class posix_error : public std::system_error {
public:
explicit posix_error(const std::string& msg,
- int errno_code,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ int errno_code,
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
class communication_error : public runtime_error {
public:
explicit communication_error(const std::string& msg,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
class protocol_error : public communication_error {
public:
explicit protocol_error(const std::string& msg,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
class invalid_argument_error : public runtime_error {
public:
explicit invalid_argument_error(const std::string& msg,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
}; /* namespace lttng */
#include <common/compat/directory-handle.hpp>
#include <common/macros.hpp>
+
#include <stdint.h>
#include <sys/types.h>
* under which unlinked files will be stored for as long as a reference to them
* is held.
*/
-struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
- unsigned int capacity);
+struct fd_tracker *fd_tracker_create(const char *unlinked_file_path, unsigned int capacity);
/* Returns an error if file descriptors are leaked. */
int fd_tracker_destroy(struct fd_tracker *tracker);
* open.
*/
struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
- struct lttng_directory_handle *directory,
- const char *path,
- int flags,
- mode_t *mode);
+ struct lttng_directory_handle *directory,
+ const char *path,
+ int flags,
+ mode_t *mode);
/*
* Open a tracked unsuspendable file descriptor.
* accommodates the request for a new unsuspendable entry.
*/
int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
- int *out_fds,
- const char **names,
- unsigned int fd_count,
- fd_open_cb open,
- void *data);
+ int *out_fds,
+ const char **names,
+ unsigned int fd_count,
+ fd_open_cb open,
+ void *data);
/*
* Close a tracked unsuspendable file descriptor.
* Closed fds are set to -1 in the fds array which, in the event of an error,
* allows the user to know which file descriptors are no longer being tracked.
*/
-int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
- int *fds,
- unsigned int fd_count,
- fd_close_cb close,
- void *data);
+int fd_tracker_close_unsuspendable_fd(
+ struct fd_tracker *tracker, int *fds, unsigned int fd_count, fd_close_cb close, void *data);
/*
* Log the contents of the fd_tracker.
#define FD_TRACKER_INODE_H
#include <common/compat/directory-handle.hpp>
+
#include <stdbool.h>
struct lttng_inode;
* by the fd-tracker. Users of the fd-tracker should account for this extra
* file descriptor.
*/
-struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
- const char *path);
+struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(const char *path);
-void lttng_unlinked_file_pool_destroy(
- struct lttng_unlinked_file_pool *pool);
+void lttng_unlinked_file_pool_destroy(struct lttng_unlinked_file_pool *pool);
/* The inode registry is protected by the fd-tracker's lock. */
struct lttng_inode_registry *lttng_inode_registry_create(void);
-struct lttng_inode *lttng_inode_registry_get_inode(
- struct lttng_inode_registry *registry,
- struct lttng_directory_handle *handle,
- const char *path,
- int fd,
- struct lttng_unlinked_file_pool *pool);
+struct lttng_inode *lttng_inode_registry_get_inode(struct lttng_inode_registry *registry,
+ struct lttng_directory_handle *handle,
+ const char *path,
+ int fd,
+ struct lttng_unlinked_file_pool *pool);
void lttng_inode_registry_destroy(struct lttng_inode_registry *registry);
void lttng_inode_borrow_location(struct lttng_inode *inode,
- const struct lttng_directory_handle **out_directory_handle,
- const char **out_path);
+ const struct lttng_directory_handle **out_directory_handle,
+ const char **out_path);
/* Returns a new reference to the inode's location directory handle. */
-struct lttng_directory_handle *lttng_inode_get_location_directory_handle(
- struct lttng_inode *inode);
+struct lttng_directory_handle *lttng_inode_get_location_directory_handle(struct lttng_inode *inode);
int lttng_inode_rename(struct lttng_inode *inode,
- struct lttng_directory_handle *old_directory_handle,
- const char *old_path,
- struct lttng_directory_handle *new_directory_handle,
- const char *new_path,
- bool overwrite);
+ struct lttng_directory_handle *old_directory_handle,
+ const char *old_path,
+ struct lttng_directory_handle *new_directory_handle,
+ const char *new_path,
+ bool overwrite);
int lttng_inode_unlink(struct lttng_inode *inode);
/*
* Create a pipe and track its underlying fds.
*/
-int fd_tracker_util_pipe_open_cloexec(
- struct fd_tracker *tracker, const char *name, int *pipe);
+int fd_tracker_util_pipe_open_cloexec(struct fd_tracker *tracker, const char *name, int *pipe);
int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe);
/*
* Create a poll event and track its underlying fd, if applicable.
*/
int fd_tracker_util_poll_create(struct fd_tracker *tracker,
- const char *name,
- struct lttng_poll_event *events,
- int size,
- int flags);
-int fd_tracker_util_poll_clean(
- struct fd_tracker *tracker, struct lttng_poll_event *events);
+ const char *name,
+ struct lttng_poll_event *events,
+ int size,
+ int flags);
+int fd_tracker_util_poll_clean(struct fd_tracker *tracker, struct lttng_poll_event *events);
-struct lttng_directory_handle *fd_tracker_create_directory_handle(
- struct fd_tracker *tracker, const char *path);
+struct lttng_directory_handle *fd_tracker_create_directory_handle(struct fd_tracker *tracker,
+ const char *path);
struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
- struct fd_tracker *tracker,
- struct lttng_directory_handle *handle,
- const char *path);
+ struct fd_tracker *tracker, struct lttng_directory_handle *handle, const char *path);
#endif /* FD_TRACKER_UTILS_H */
void write(const void *buffer, std::size_t size);
int fd() const noexcept;
+
protected:
void _cleanup() noexcept;
* Create an iterator on a bytecode's symbols. The iterator points to the
* first element after creation.
*/
-struct bytecode_symbol_iterator *bytecode_symbol_iterator_create(
- struct lttng_bytecode *bytecode);
+struct bytecode_symbol_iterator *bytecode_symbol_iterator_create(struct lttng_bytecode *bytecode);
/*
* Advance iterator of one element.
int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator *it);
-const char *bytecode_symbol_iterator_get_name(
- struct bytecode_symbol_iterator *it);
+const char *bytecode_symbol_iterator_get_name(struct bytecode_symbol_iterator *it);
void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator *it);
* Note: filter-ast.h should be included before filter-parser.h.
*/
-#include <urcu/list.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
+#include <urcu/list.h>
-#define printf_debug(fmt, args...) \
- do { \
- if (filter_parser_debug) \
- fprintf(stdout, "[debug] " fmt, ## args); \
+#define printf_debug(fmt, args...) \
+ do { \
+ if (filter_parser_debug) \
+ fprintf(stdout, "[debug] " fmt, ##args); \
} while (0)
// the parameter name (of the reentrant 'yyparse' function)
} root;
struct {
enum ast_expt_type type;
- enum ast_link_type post_op; /* reverse */
- enum ast_link_type pre_op; /* forward */
+ enum ast_link_type post_op; /* reverse */
+ enum ast_link_type pre_op; /* forward */
union {
const char *string;
uint64_t constant;
struct filter_parser_ctx *filter_parser_ctx_alloc(FILE *input);
void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx);
int filter_parser_ctx_append_ast(struct filter_parser_ctx *parser_ctx);
-int filter_parser_ctx_create_from_filter_expression(
- const char *filter_expression, struct filter_parser_ctx **ctxp);
+int filter_parser_ctx_create_from_filter_expression(const char *filter_expression,
+ struct filter_parser_ctx **ctxp);
-static inline
-struct filter_ast *filter_parser_get_ast(struct filter_parser_ctx *parser_ctx)
+static inline struct filter_ast *filter_parser_get_ast(struct filter_parser_ctx *parser_ctx)
{
return parser_ctx->ast;
}
-int filter_visitor_print_xml(struct filter_parser_ctx *ctx, FILE *stream,
- int indent);
+int filter_visitor_print_xml(struct filter_parser_ctx *ctx, FILE *stream, int indent);
int filter_visitor_ir_generate(struct filter_parser_ctx *ctx);
void filter_ir_free(struct filter_parser_ctx *ctx);
int filter_visitor_bytecode_generate(struct filter_parser_ctx *ctx);
IR_SIGN_UNKNOWN = 0,
IR_SIGNED,
IR_UNSIGNED,
- IR_SIGN_DYN, /* signedness determined dynamically */
+ IR_SIGN_DYN, /* signedness determined dynamically */
};
enum ir_data_type {
IR_DATA_UNKNOWN = 0,
IR_DATA_STRING,
- IR_DATA_NUMERIC, /* numeric and boolean */
+ IR_DATA_NUMERIC, /* numeric and boolean */
IR_DATA_FLOAT,
IR_DATA_FIELD_REF,
IR_DATA_GET_CONTEXT_REF,
IR_DATA_EXPRESSION,
};
-static inline
-const char *ir_data_type_str(enum ir_data_type type)
+static inline const char *ir_data_type_str(enum ir_data_type type)
{
switch (type) {
case IR_DATA_UNKNOWN:
IR_OP_LOGICAL,
};
-static inline
-const char *ir_op_type_str(enum ir_op_type type)
+static inline const char *ir_op_type_str(enum ir_op_type type)
{
switch (type) {
case IR_OP_UNKNOWN:
IR_LOAD_EXPRESSION_LOAD_FIELD,
};
-static inline
-const char *ir_load_expression_type_str(enum ir_load_expression_type type)
+static inline const char *ir_load_expression_type_str(enum ir_load_expression_type type)
{
switch (type) {
case IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT:
*
*/
-#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_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 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
+#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 */
#ifdef LTTNG_HAVE_FMEMOPEN
#include <stdio.h>
-static inline
-FILE *lttng_fmemopen(void *buf, size_t size, const char *mode)
+static inline FILE *lttng_fmemopen(void *buf, size_t size, const char *mode)
{
return fmemopen(buf, size, mode);
}
#else /* LTTNG_HAVE_FMEMOPEN */
-#include <stdlib.h>
-#include <stdio.h>
#include <common/error.hpp>
+#include <stdio.h>
+#include <stdlib.h>
+
/*
* Fallback for systems which don't have fmemopen. Copy buffer to a
* temporary file, and use that file as FILE * input.
*/
-static inline
-FILE *lttng_fmemopen(void *buf, size_t size, const char *mode)
+static inline FILE *lttng_fmemopen(void *buf, size_t size, const char *mode)
{
char tmpname[PATH_MAX];
size_t len;
#include <common/macros.hpp>
-#include <string>
#include <cxxabi.h>
+#include <string>
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT
#define FS_HANDLE_H
#include <common/macros.hpp>
+
#include <stdio.h>
struct fs_handle;
*
*/
-#define _cds_lfht_new lttng__cds_lfht_new
-#define cds_lfht_add lttng_cds_lfht_add
-#define cds_lfht_add_replace lttng_cds_lfht_add_replace
-#define cds_lfht_add_unique lttng_cds_lfht_add_unique
-#define cds_lfht_count_nodes lttng_cds_lfht_count_nodes
-#define cds_lfht_del lttng_cds_lfht_del
-#define cds_lfht_destroy lttng_cds_lfht_destroy
-#define cds_lfht_first lttng_cds_lfht_first
-#define cds_lfht_fls_ulong lttng_cds_lfht_fls_ulong
-#define cds_lfht_get_count_order_u32 lttng_cds_lfht_get_count_order_u32
+#define _cds_lfht_new lttng__cds_lfht_new
+#define cds_lfht_add lttng_cds_lfht_add
+#define cds_lfht_add_replace lttng_cds_lfht_add_replace
+#define cds_lfht_add_unique lttng_cds_lfht_add_unique
+#define cds_lfht_count_nodes lttng_cds_lfht_count_nodes
+#define cds_lfht_del lttng_cds_lfht_del
+#define cds_lfht_destroy lttng_cds_lfht_destroy
+#define cds_lfht_first lttng_cds_lfht_first
+#define cds_lfht_fls_ulong lttng_cds_lfht_fls_ulong
+#define cds_lfht_get_count_order_u32 lttng_cds_lfht_get_count_order_u32
#define cds_lfht_get_count_order_ulong lttng_cds_lfht_get_count_order_ulong
-#define cds_lfht_is_node_deleted lttng_cds_lfht_is_node_deleted
-#define cds_lfht_lookup lttng_cds_lfht_lookup
-#define cds_lfht_next lttng_cds_lfht_next
-#define cds_lfht_next_duplicate lttng_cds_lfht_next_duplicate
-#define cds_lfht_replace lttng_cds_lfht_replace
-#define cds_lfht_resize lttng_cds_lfht_resize
+#define cds_lfht_is_node_deleted lttng_cds_lfht_is_node_deleted
+#define cds_lfht_lookup lttng_cds_lfht_lookup
+#define cds_lfht_next lttng_cds_lfht_next
+#define cds_lfht_next_duplicate lttng_cds_lfht_next_duplicate
+#define cds_lfht_replace lttng_cds_lfht_replace
+#define cds_lfht_resize lttng_cds_lfht_resize
#endif /* _HASHTABLE_SYMBOLS_H */
#ifndef _LTT_HT_H
#define _LTT_HT_H
-#include <urcu.h>
-#include <stdint.h>
-#include <memory>
-
#include <common/macros.hpp>
+
#include <lttng/lttng-export.h>
+
+#include <memory>
+#include <stdint.h>
+#include <urcu.h>
#include <urcu/rculfhash.h>
LTTNG_EXPORT extern unsigned long lttng_ht_seed;
struct lttng_ht *lttng_ht_new(unsigned long size, enum lttng_ht_type type);
void lttng_ht_destroy(struct lttng_ht *ht);
struct lttng_ht_deleter {
- void operator()(lttng_ht *ht) { lttng_ht_destroy(ht); };
+ void operator()(lttng_ht *ht)
+ {
+ lttng_ht_destroy(ht);
+ };
};
/* Specialized node init and free functions */
void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key);
-void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node,
- unsigned long key);
-void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node,
- uint64_t key);
-void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node,
- uint64_t key1, uint64_t key2);
+void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node, unsigned long key);
+void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node, uint64_t key);
+void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node, uint64_t key1, uint64_t key2);
void lttng_ht_node_free_str(struct lttng_ht_node_str *node);
void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node);
void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node);
void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node);
-void lttng_ht_lookup(struct lttng_ht *ht, const void *key,
- struct lttng_ht_iter *iter);
+void lttng_ht_lookup(struct lttng_ht *ht, const void *key, struct lttng_ht_iter *iter);
/* Specialized add unique functions */
-void lttng_ht_add_unique_str(struct lttng_ht *ht,
- struct lttng_ht_node_str *node);
-void lttng_ht_add_unique_ulong(struct lttng_ht *ht,
- struct lttng_ht_node_ulong *node);
-void lttng_ht_add_unique_u64(struct lttng_ht *ht,
- struct lttng_ht_node_u64 *node);
-void lttng_ht_add_unique_two_u64(struct lttng_ht *ht,
- struct lttng_ht_node_two_u64 *node);
-struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(
- struct lttng_ht *ht, struct lttng_ht_node_ulong *node);
-struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(
- struct lttng_ht *ht, struct lttng_ht_node_u64 *node);
-void lttng_ht_add_str(struct lttng_ht *ht,
- struct lttng_ht_node_str *node);
-void lttng_ht_add_ulong(struct lttng_ht *ht,
- struct lttng_ht_node_ulong *node);
-void lttng_ht_add_u64(struct lttng_ht *ht,
- struct lttng_ht_node_u64 *node);
+void lttng_ht_add_unique_str(struct lttng_ht *ht, struct lttng_ht_node_str *node);
+void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node);
+void lttng_ht_add_unique_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node);
+void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, struct lttng_ht_node_two_u64 *node);
+struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
+ struct lttng_ht_node_ulong *node);
+struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
+ struct lttng_ht_node_u64 *node);
+void lttng_ht_add_str(struct lttng_ht *ht, struct lttng_ht_node_str *node);
+void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node);
+void lttng_ht_add_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node);
int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter);
-void lttng_ht_get_first(struct lttng_ht *ht,
- struct lttng_ht_iter *iter);
+void lttng_ht_get_first(struct lttng_ht *ht, struct lttng_ht_iter *iter);
void lttng_ht_get_next(struct lttng_ht *ht, struct lttng_ht_iter *iter);
unsigned long lttng_ht_get_count(struct lttng_ht *ht);
-struct lttng_ht_node_str *lttng_ht_iter_get_node_str(
- struct lttng_ht_iter *iter);
-struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(
- struct lttng_ht_iter *iter);
-struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(
- struct lttng_ht_iter *iter);
-struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(
- struct lttng_ht_iter *iter);
+struct lttng_ht_node_str *lttng_ht_iter_get_node_str(struct lttng_ht_iter *iter);
+struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(struct lttng_ht_iter *iter);
+struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(struct lttng_ht_iter *iter);
+struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(struct lttng_ht_iter *iter);
#endif /* _LTT_HT_H */
#ifndef _COMMON_INDEX_ALLOCATOR_H
#define _COMMON_INDEX_ALLOCATOR_H
-#include <inttypes.h>
#include <lttng/lttng-export.h>
+#include <inttypes.h>
+
struct lttng_index_allocator;
enum lttng_index_allocator_status {
/*
* Create an index allocator of `index_count` slots.
*/
-extern "C" LTTNG_EXPORT
-struct lttng_index_allocator *lttng_index_allocator_create(
- uint64_t index_count);
+extern "C" LTTNG_EXPORT struct lttng_index_allocator *
+lttng_index_allocator_create(uint64_t index_count);
/*
* Get the number of indexes currently in use.
*/
-extern "C" LTTNG_EXPORT
-uint64_t lttng_index_allocator_get_index_count(
- struct lttng_index_allocator *allocator);
+extern "C" LTTNG_EXPORT uint64_t
+lttng_index_allocator_get_index_count(struct lttng_index_allocator *allocator);
/*
* Allocate (i.e. reserve) a slot.
*/
-extern "C" LTTNG_EXPORT
-enum lttng_index_allocator_status lttng_index_allocator_alloc(
- struct lttng_index_allocator *allocator,
- uint64_t *index);
+extern "C" 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.
*/
-extern "C" LTTNG_EXPORT
-enum lttng_index_allocator_status lttng_index_allocator_release(
- struct lttng_index_allocator *allocator, uint64_t index);
+extern "C" LTTNG_EXPORT enum lttng_index_allocator_status
+lttng_index_allocator_release(struct lttng_index_allocator *allocator, uint64_t index);
/*
* Destroy an index allocator.
*/
-extern "C" LTTNG_EXPORT
-void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator);
+extern "C" LTTNG_EXPORT void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator);
#endif /* _COMMON_INDEX_ALLOCATOR_H */
#include <common/compat/endian.hpp>
#include <common/macros.hpp>
-#include <stdint.h>
#include <limits.h>
#include <stddef.h>
+#include <stdint.h>
#define CTF_INDEX_MAGIC 0xC1F1DCC1
#define CTF_INDEX_MAJOR 1
* All integer fields are stored in big endian.
*/
struct ctf_packet_index {
- uint64_t offset; /* offset of the packet in the file, in bytes */
- uint64_t packet_size; /* packet size, in bits */
- uint64_t content_size; /* content size, in bits */
+ uint64_t offset; /* offset of the packet in the file, in bytes */
+ uint64_t packet_size; /* packet size, in bits */
+ uint64_t content_size; /* content size, in bits */
uint64_t timestamp_begin;
uint64_t timestamp_end;
uint64_t events_discarded;
- uint64_t stream_id; /* ID of the channel */
+ uint64_t stream_id; /* ID of the channel */
/* CTF_INDEX 1.0 limit */
- uint64_t stream_instance_id; /* ID of the channel instance */
- uint64_t packet_seq_num; /* packet sequence number */
+ uint64_t stream_instance_id; /* ID of the channel instance */
+ uint64_t packet_seq_num; /* packet sequence number */
} __attribute__((__packed__));
static inline size_t ctf_packet_index_len(uint32_t major, uint32_t minor)
if (major == 1) {
switch (minor) {
case 0:
- return offsetof(struct ctf_packet_index, stream_id)
- + member_sizeof(struct ctf_packet_index,
- stream_id);
+ return offsetof(struct ctf_packet_index, stream_id) +
+ member_sizeof(struct ctf_packet_index, stream_id);
case 1:
- return offsetof(struct ctf_packet_index, packet_seq_num)
- + member_sizeof(struct ctf_packet_index,
- packet_seq_num);
+ return offsetof(struct ctf_packet_index, packet_seq_num) +
+ member_sizeof(struct ctf_packet_index, packet_seq_num);
default:
abort();
}
}
static inline uint32_t lttng_to_index_major(uint32_t lttng_major,
- uint32_t lttng_minor __attribute__((unused)))
+ uint32_t lttng_minor __attribute__((unused)))
{
if (lttng_major == 2) {
return 1;
abort();
}
-static inline uint32_t lttng_to_index_minor(uint32_t lttng_major,
- uint32_t lttng_minor)
+static inline uint32_t lttng_to_index_minor(uint32_t lttng_major, uint32_t lttng_minor)
{
if (lttng_major == 2) {
if (lttng_minor < 8) {
abort();
}
-static inline void ctf_packet_index_file_hdr_init(
- struct ctf_packet_index_file_hdr *hdr,
- uint32_t idx_major, uint32_t idx_minor)
+static inline void ctf_packet_index_file_hdr_init(struct ctf_packet_index_file_hdr *hdr,
+ uint32_t idx_major,
+ uint32_t idx_minor)
{
memset(hdr, 0, sizeof(*hdr));
hdr->magic = htobe32(CTF_INDEX_MAGIC);
hdr->index_major = htobe32(idx_major);
hdr->index_minor = htobe32(idx_minor);
- hdr->packet_index_len = htobe32(
- ctf_packet_index_len(idx_major, idx_minor));
+ hdr->packet_index_len = htobe32(ctf_packet_index_len(idx_major, idx_minor));
}
#endif /* LTTNG_INDEX_H */
#ifndef _INDEX_H
#define _INDEX_H
-#include <inttypes.h>
-#include <urcu/ref.h>
-
#include "ctf-index.hpp"
+
#include <common/fs-handle.hpp>
#include <common/trace-chunk.hpp>
+#include <inttypes.h>
+#include <urcu/ref.h>
+
struct lttng_index_file {
struct fs_handle *file;
uint32_t major;
* create and open have refcount of 1. Use put to decrement the
* refcount. Destroys when reaching 0. Use "get" to increment refcount.
*/
-enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk(
- struct lttng_trace_chunk *chunk,
- const char *channel_path, const char *stream_name,
- uint64_t stream_file_size, uint64_t stream_count,
- uint32_t index_major, uint32_t index_minor,
- bool unlink_existing_file, struct lttng_index_file **file);
-
-enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk_read_only(
- struct lttng_trace_chunk *chunk,
- const char *channel_path, const char *stream_name,
- uint64_t stream_file_size, uint64_t stream_file_index,
- uint32_t index_major, uint32_t index_minor,
- bool expect_no_file, struct lttng_index_file **file);
+enum lttng_trace_chunk_status
+lttng_index_file_create_from_trace_chunk(struct lttng_trace_chunk *chunk,
+ const char *channel_path,
+ const char *stream_name,
+ uint64_t stream_file_size,
+ uint64_t stream_count,
+ uint32_t index_major,
+ uint32_t index_minor,
+ bool unlink_existing_file,
+ struct lttng_index_file **file);
+
+enum lttng_trace_chunk_status
+lttng_index_file_create_from_trace_chunk_read_only(struct lttng_trace_chunk *chunk,
+ const char *channel_path,
+ const char *stream_name,
+ uint64_t stream_file_size,
+ uint64_t stream_file_index,
+ uint32_t index_major,
+ uint32_t index_minor,
+ bool expect_no_file,
+ struct lttng_index_file **file);
int lttng_index_file_write(const struct lttng_index_file *index_file,
- const struct ctf_packet_index *element);
+ const struct ctf_packet_index *element);
int lttng_index_file_read(const struct lttng_index_file *index_file,
- struct ctf_packet_index *element);
+ struct ctf_packet_index *element);
void lttng_index_file_get(struct lttng_index_file *index_file);
void lttng_index_file_put(struct lttng_index_file *index_file);
* Returns 0 on success. Negative values are error codes. If the return value
* is positive, it represents the line number on which a parsing error occurred.
*/
-int config_get_section_entries(const char *path, const char *section,
- config_entry_handler_cb handler, void *user_data);
+int config_get_section_entries(const char *path,
+ const char *section,
+ config_entry_handler_cb handler,
+ void *user_data);
/*
* Parse a configuration value.
#ifndef _LTTNG_KCONSUMER_H
#define _LTTNG_KCONSUMER_H
-#include <stdbool.h>
#include <common/consumer/consumer.hpp>
+#include <stdbool.h>
+
int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream);
-int lttng_kconsumer_sample_snapshot_positions(
- struct lttng_consumer_stream *stream);
-int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
- unsigned long *pos);
-int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
- unsigned long *pos);
+int lttng_kconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream);
+int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos);
+int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos);
int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
- int sock, struct pollfd *consumer_sockpoll);
+ int sock,
+ struct pollfd *consumer_sockpoll);
int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream);
-enum sync_metadata_status lttng_kconsumer_sync_metadata(
- struct lttng_consumer_stream *metadata);
+enum sync_metadata_status lttng_kconsumer_sync_metadata(struct lttng_consumer_stream *metadata);
#endif /* _LTTNG_KCONSUMER_H */
#ifndef _LTTNG_KERNEL_CTL_H
#define _LTTNG_KERNEL_CTL_H
-#include <stdbool.h>
+#include <common/lttng-kernel-old.hpp>
+#include <common/lttng-kernel.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp> /* for struct lttng_filter_bytecode */
#include <lttng/lttng.h>
-#include <common/lttng-kernel.hpp>
-#include <common/lttng-kernel-old.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp> /* for struct lttng_filter_bytecode */
+
+#include <stdbool.h>
int kernctl_create_session(int fd);
int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops);
/* Apply on event notifier_group file descriptor. */
int kernctl_create_event_notifier_group_notification_fd(int fd);
-int kernctl_create_event_notifier_group_error_counter(int fd,
- const struct lttng_kernel_abi_counter_conf *error_counter_conf);
+int kernctl_create_event_notifier_group_error_counter(
+ int fd, const struct lttng_kernel_abi_counter_conf *error_counter_conf);
int kernctl_create_event_notifier(int fd,
- const struct lttng_kernel_abi_event_notifier *event_notifier);
+ const struct lttng_kernel_abi_event_notifier *event_notifier);
int kernctl_counter_get_aggregate_value(int counter_fd,
- struct lttng_kernel_abi_counter_aggregate *value);
-int kernctl_counter_clear(int counter_fd,
- struct lttng_kernel_abi_counter_clear *clear);
+ struct lttng_kernel_abi_counter_aggregate *value);
+int kernctl_counter_clear(int counter_fd, struct lttng_kernel_abi_counter_clear *clear);
/* Apply on event file descriptor. */
int kernctl_filter(int fd, const struct lttng_bytecode *filter);
* It returns 0 if OK, -1 on error. In all cases (error and OK),
* @syscall_mask should be freed by the caller with free(3).
*/
-int kernctl_syscall_mask(int fd, char **syscall_mask,
- uint32_t *nr_bits);
+int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits);
/* Process ID tracking can be applied to session file descriptor. */
int kernctl_track_pid(int fd, int pid);
#ifndef _LTT_KERNEL_IOCTL_H
#define _LTT_KERNEL_IOCTL_H
-#define LTTNG_KERNEL_ABI_MAJOR_VERSION 2
-#define LTTNG_KERNEL_ABI_MINOR_VERSION 6
+#define LTTNG_KERNEL_ABI_MAJOR_VERSION 2
+#define LTTNG_KERNEL_ABI_MINOR_VERSION 6
/* Get a snapshot of the current ring buffer producer and consumer positions */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00)
/* Get the consumer position (iteration start) */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED _IOR(0xF6, 0x01, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED _IOR(0xF6, 0x01, unsigned long)
/* Get the producer position (iteration end) */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED _IOR(0xF6, 0x02, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED _IOR(0xF6, 0x02, unsigned long)
/* Get exclusive read access to the specified sub-buffer position */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF _IOW(0xF6, 0x03, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF _IOW(0xF6, 0x03, unsigned long)
/* Release exclusive sub-buffer access */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_SUBBUF _IO(0xF6, 0x04)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_SUBBUF _IO(0xF6, 0x04)
/* Get exclusive read access to the next sub-buffer that can be read. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF _IO(0xF6, 0x05)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF _IO(0xF6, 0x05)
/* Release exclusive sub-buffer access, move consumer forward. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_NEXT_SUBBUF _IO(0xF6, 0x06)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_NEXT_SUBBUF _IO(0xF6, 0x06)
/* returns the size of the current sub-buffer, without padding (for mmap). */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE _IOR(0xF6, 0x07, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE _IOR(0xF6, 0x07, unsigned long)
/* returns the size of the current sub-buffer, with padding (for splice). */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE _IOR(0xF6, 0x08, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE _IOR(0xF6, 0x08, unsigned long)
/* returns the maximum size for sub-buffers. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE _IOR(0xF6, 0x09, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE _IOR(0xF6, 0x09, unsigned long)
/* returns the length to mmap. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long)
/* returns the offset of the subbuffer belonging to the mmap reader. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long)
/* Flush the current sub-buffer, if non-empty. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH _IO(0xF6, 0x0C)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH _IO(0xF6, 0x0C)
/* Get the current version of the metadata cache (after a get_next). */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION _IOR(0xF6, 0x0D, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION _IOR(0xF6, 0x0D, uint64_t)
/*
* Get a snapshot of the current ring buffer producer and consumer positions,
* regardless of whether or not the two positions are contained within the same
* sub-buffer.
*/
-#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS _IO(0xF6, 0x0E)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS _IO(0xF6, 0x0E)
/* Flush the current sub-buffer, even if empty. */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY _IO(0xF6, 0x0F)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY _IO(0xF6, 0x0F)
/*
* Reset the position of what has been consumed from the metadata cache to 0
* so it can be read again.
*/
-#define LTTNG_KERNEL_ABI_RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10)
/* Clear ring buffer content */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_CLEAR _IO(0xF6, 0x11)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_CLEAR _IO(0xF6, 0x11)
#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK _IOR(0xF6, 0x12, uint32_t)
/* returns the timestamp begin of the current sub-buffer */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t)
/* returns the timestamp end of the current sub-buffer */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t)
/* returns the number of events discarded */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t)
/* returns the packet payload size */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t)
/* returns the actual packet size */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t)
/* returns the stream id */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t)
/* returns the current timestamp */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
/* returns the packet sequence number */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t)
/* returns the stream instance id */
-#define LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t)
+#define LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t)
/* Old ABI (without support for 32/64 bits compat) */
/* LTTng file descriptor ioctl */
-#define LTTNG_KERNEL_ABI_OLD_SESSION _IO(0xF6, 0x40)
-#define LTTNG_KERNEL_ABI_OLD_TRACER_VERSION \
- _IOR(0xF6, 0x41, struct lttng_kernel_abi_old_tracer_version)
-#define LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42)
-#define LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43)
+#define LTTNG_KERNEL_ABI_OLD_SESSION _IO(0xF6, 0x40)
+#define LTTNG_KERNEL_ABI_OLD_TRACER_VERSION \
+ _IOR(0xF6, 0x41, struct lttng_kernel_abi_old_tracer_version)
+#define LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42)
+#define LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43)
/* Session FD ioctl */
-#define LTTNG_KERNEL_ABI_OLD_METADATA \
- _IOW(0xF6, 0x50, struct lttng_kernel_abi_old_channel)
-#define LTTNG_KERNEL_ABI_OLD_CHANNEL \
- _IOW(0xF6, 0x51, struct lttng_kernel_abi_old_channel)
-#define LTTNG_KERNEL_ABI_OLD_SESSION_START _IO(0xF6, 0x52)
-#define LTTNG_KERNEL_ABI_OLD_SESSION_STOP _IO(0xF6, 0x53)
+#define LTTNG_KERNEL_ABI_OLD_METADATA _IOW(0xF6, 0x50, struct lttng_kernel_abi_old_channel)
+#define LTTNG_KERNEL_ABI_OLD_CHANNEL _IOW(0xF6, 0x51, struct lttng_kernel_abi_old_channel)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_START _IO(0xF6, 0x52)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_STOP _IO(0xF6, 0x53)
/* Channel FD ioctl */
-#define LTTNG_KERNEL_ABI_OLD_STREAM _IO(0xF6, 0x60)
-#define LTTNG_KERNEL_ABI_OLD_EVENT \
- _IOW(0xF6, 0x61, struct lttng_kernel_abi_old_event)
+#define LTTNG_KERNEL_ABI_OLD_STREAM _IO(0xF6, 0x60)
+#define LTTNG_KERNEL_ABI_OLD_EVENT _IOW(0xF6, 0x61, struct lttng_kernel_abi_old_event)
/* Event and Channel FD ioctl */
-#define LTTNG_KERNEL_ABI_OLD_CONTEXT \
- _IOW(0xF6, 0x70, struct lttng_kernel_abi_old_context)
+#define LTTNG_KERNEL_ABI_OLD_CONTEXT _IOW(0xF6, 0x70, struct lttng_kernel_abi_old_context)
/* Event, Channel and Session ioctl */
-#define LTTNG_KERNEL_ABI_OLD_ENABLE _IO(0xF6, 0x80)
-#define LTTNG_KERNEL_ABI_OLD_DISABLE _IO(0xF6, 0x81)
-
+#define LTTNG_KERNEL_ABI_OLD_ENABLE _IO(0xF6, 0x80)
+#define LTTNG_KERNEL_ABI_OLD_DISABLE _IO(0xF6, 0x81)
/* Current ABI (with suport for 32/64 bits compat) */
/* LTTng file descriptor ioctl */
-#define LTTNG_KERNEL_ABI_SESSION _IO(0xF6, 0x45)
-#define LTTNG_KERNEL_ABI_TRACER_VERSION \
- _IOR(0xF6, 0x46, struct lttng_kernel_abi_tracer_version)
-#define LTTNG_KERNEL_ABI_TRACEPOINT_LIST _IO(0xF6, 0x47)
-#define LTTNG_KERNEL_ABI_WAIT_QUIESCENT _IO(0xF6, 0x48)
-#define LTTNG_KERNEL_ABI_SYSCALL_LIST _IO(0xF6, 0x4A)
-#define LTTNG_KERNEL_ABI_TRACER_ABI_VERSION \
+#define LTTNG_KERNEL_ABI_SESSION _IO(0xF6, 0x45)
+#define LTTNG_KERNEL_ABI_TRACER_VERSION _IOR(0xF6, 0x46, struct lttng_kernel_abi_tracer_version)
+#define LTTNG_KERNEL_ABI_TRACEPOINT_LIST _IO(0xF6, 0x47)
+#define LTTNG_KERNEL_ABI_WAIT_QUIESCENT _IO(0xF6, 0x48)
+#define LTTNG_KERNEL_ABI_SYSCALL_LIST _IO(0xF6, 0x4A)
+#define LTTNG_KERNEL_ABI_TRACER_ABI_VERSION \
_IOR(0xF6, 0x4B, struct lttng_kernel_abi_tracer_abi_version)
-#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE \
- _IO(0xF6, 0x4C)
+#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE _IO(0xF6, 0x4C)
/* Session FD ioctl */
-#define LTTNG_KERNEL_ABI_METADATA \
- _IOW(0xF6, 0x54, struct lttng_kernel_abi_channel)
-#define LTTNG_KERNEL_ABI_CHANNEL \
- _IOW(0xF6, 0x55, struct lttng_kernel_abi_channel)
-#define LTTNG_KERNEL_ABI_SESSION_START _IO(0xF6, 0x56)
-#define LTTNG_KERNEL_ABI_SESSION_STOP _IO(0xF6, 0x57)
-#define LTTNG_KERNEL_ABI_SESSION_TRACK_PID \
- _IOW(0xF6, 0x58, int32_t)
-#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID \
- _IOW(0xF6, 0x59, int32_t)
+#define LTTNG_KERNEL_ABI_METADATA _IOW(0xF6, 0x54, struct lttng_kernel_abi_channel)
+#define LTTNG_KERNEL_ABI_CHANNEL _IOW(0xF6, 0x55, struct lttng_kernel_abi_channel)
+#define LTTNG_KERNEL_ABI_SESSION_START _IO(0xF6, 0x56)
+#define LTTNG_KERNEL_ABI_SESSION_STOP _IO(0xF6, 0x57)
+#define LTTNG_KERNEL_ABI_SESSION_TRACK_PID _IOW(0xF6, 0x58, int32_t)
+#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID _IOW(0xF6, 0x59, int32_t)
/*
* ioctl 0x58 and 0x59 are duplicated here. It works, since _IOR vs _IO
* are generating two different ioctl numbers, but this was not done on
* purpose. We should generally try to avoid those duplications.
*/
-#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58)
-#define LTTNG_KERNEL_ABI_SESSION_METADATA_REGEN _IO(0xF6, 0x59)
+#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58)
+#define LTTNG_KERNEL_ABI_SESSION_METADATA_REGEN _IO(0xF6, 0x59)
/* 0x5A and 0x5B are reserved for a future ABI-breaking cleanup. */
-#define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C)
-#define LTTNG_KERNEL_ABI_SESSION_SET_NAME \
- _IOW(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
-#define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \
+#define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C)
+#define LTTNG_KERNEL_ABI_SESSION_SET_NAME _IOW(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
+#define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \
_IOW(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time)
/* Channel FD ioctl */
-#define LTTNG_KERNEL_ABI_STREAM _IO(0xF6, 0x62)
-#define LTTNG_KERNEL_ABI_EVENT \
- _IOW(0xF6, 0x63, struct lttng_kernel_abi_event)
-#define LTTNG_KERNEL_ABI_SYSCALL_MASK \
- _IOWR(0xF6, 0x64, struct lttng_kernel_abi_syscall_mask)
+#define LTTNG_KERNEL_ABI_STREAM _IO(0xF6, 0x62)
+#define LTTNG_KERNEL_ABI_EVENT _IOW(0xF6, 0x63, struct lttng_kernel_abi_event)
+#define LTTNG_KERNEL_ABI_SYSCALL_MASK _IOWR(0xF6, 0x64, struct lttng_kernel_abi_syscall_mask)
/* Event and Channel FD ioctl */
-#define LTTNG_KERNEL_ABI_CONTEXT \
- _IOW(0xF6, 0x71, struct lttng_kernel_abi_context)
+#define LTTNG_KERNEL_ABI_CONTEXT _IOW(0xF6, 0x71, struct lttng_kernel_abi_context)
/* Event, event notifier, Channel and Session ioctl */
-#define LTTNG_KERNEL_ABI_ENABLE _IO(0xF6, 0x82)
-#define LTTNG_KERNEL_ABI_DISABLE _IO(0xF6, 0x83)
+#define LTTNG_KERNEL_ABI_ENABLE _IO(0xF6, 0x82)
+#define LTTNG_KERNEL_ABI_DISABLE _IO(0xF6, 0x83)
/* Event notifier group ioctl */
-#define LTTNG_KERNEL_ABI_COUNTER \
- _IOW(0xF6, 0x84, struct lttng_kernel_abi_counter_conf)
+#define LTTNG_KERNEL_ABI_COUNTER _IOW(0xF6, 0x84, struct lttng_kernel_abi_counter_conf)
/* Event and event notifier FD ioctl */
-#define LTTNG_KERNEL_ABI_FILTER _IO(0xF6, 0x90)
-#define LTTNG_KERNEL_ABI_ADD_CALLSITE _IO(0xF6, 0x91)
+#define LTTNG_KERNEL_ABI_FILTER _IO(0xF6, 0x90)
+#define LTTNG_KERNEL_ABI_ADD_CALLSITE _IO(0xF6, 0x91)
/* Session FD ioctl (continued) */
-#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \
+#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \
_IOW(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args)
-#define LTTNG_KERNEL_ABI_SESSION_TRACK_ID \
- _IOW(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
-#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID \
- _IOW(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
+#define LTTNG_KERNEL_ABI_SESSION_TRACK_ID _IOW(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
+#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID _IOW(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
/* Event notifier group file descriptor ioctl */
-#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE \
+#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE \
_IOW(0xF6, 0xB0, struct lttng_kernel_abi_event_notifier)
-#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD \
- _IO(0xF6, 0xB1)
+#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD _IO(0xF6, 0xB1)
/* Event notifier file descriptor ioctl */
-#define LTTNG_KERNEL_ABI_CAPTURE _IO(0xF6, 0xB8)
+#define LTTNG_KERNEL_ABI_CAPTURE _IO(0xF6, 0xB8)
/* Counter file descriptor ioctl */
-#define LTTNG_KERNEL_ABI_COUNTER_READ \
- IOWR(0xF6, 0xC0, struct lttng_kernel_abi_counter_read)
-#define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE \
+#define LTTNG_KERNEL_ABI_COUNTER_READ IOWR(0xF6, 0xC0, struct lttng_kernel_abi_counter_read)
+#define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE \
_IOWR(0xF6, 0xC1, struct lttng_kernel_abi_counter_aggregate)
-#define LTTNG_KERNEL_ABI_COUNTER_CLEAR \
- _IOW(0xF6, 0xC2, struct lttng_kernel_abi_counter_clear)
+#define LTTNG_KERNEL_ABI_COUNTER_CLEAR _IOW(0xF6, 0xC2, struct lttng_kernel_abi_counter_clear)
/*
- * Those ioctl numbers use the wrong direction, but are kept for ABI backward
- * compatibility.
- */
- #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME \
- _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
- #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME \
- _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time)
- #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID \
- _IOW(0xF6, 0x58, int32_t)
- #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID \
- _IOW(0xF6, 0x59, int32_t)
- #define LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS \
- _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args)
- #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID \
- _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
- #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID \
- _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
+ * Those ioctl numbers use the wrong direction, but are kept for ABI backward
+ * compatibility.
+ */
+#define LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME \
+ _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID _IOW(0xF6, 0x58, int32_t)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID _IOW(0xF6, 0x59, int32_t)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS \
+ _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
+#define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID \
+ _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
#endif /* _LTT_KERNEL_IOCTL_H */
return _value;
}
- WrappedType* operator->() const
+ WrappedType *operator->() const
{
return &_value;
}
#include <lttng/lttng-export.h>
-extern "C" LTTNG_EXPORT
-int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset);
+extern "C" LTTNG_EXPORT int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset);
-extern "C" 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);
+extern "C" 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 */
+#endif /* _LTTNG_ELF_H */
#ifndef _LTTNG_KERNEL_OLD_H
#define _LTTNG_KERNEL_OLD_H
-#include <stdint.h>
#include <common/lttng-kernel.hpp>
+#include <stdint.h>
+
/*
* LTTng DebugFS ABI structures.
*
};
/* Event/Channel context */
-#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1 16
-#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
+#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1 16
+#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
struct lttng_kernel_abi_old_context {
enum lttng_kernel_abi_context_type ctx;
char padding[LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1];
char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
};
-#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING1 16
-#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
+#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING1 16
+#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
struct lttng_kernel_abi_old_event {
char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
enum lttng_kernel_abi_instrumentation instrumentation;
*/
#define LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1 ((LTTNG_SYMBOL_NAME_LEN + 32))
struct lttng_kernel_abi_old_channel {
- int overwrite; /* 1: overwrite, 0: discard */
- uint64_t subbuf_size; /* bytes */
- uint64_t num_subbuf; /* power of 2 */
+ int overwrite; /* 1: overwrite, 0: discard */
+ uint64_t subbuf_size; /* bytes */
+ uint64_t num_subbuf; /* power of 2 */
unsigned int switch_timer_interval; /* usec */
- unsigned int read_timer_interval; /* usec */
- enum lttng_event_output output; /* splice, mmap */
+ unsigned int read_timer_interval; /* usec */
+ enum lttng_event_output output; /* splice, mmap */
char padding[LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1];
};
#ifndef _LTTNG_KERNEL_H
#define _LTTNG_KERNEL_H
-#include <stdint.h>
#include <common/compiler.hpp>
#include <common/macros.hpp>
+
#include <lttng/constant.h>
#include <lttng/event.h>
-#define LTTNG_KERNEL_ABI_SYM_NAME_LEN 256
-#define LTTNG_KERNEL_ABI_MAX_UPROBE_NUM 32
-#define LTTNG_KERNEL_ABI_SESSION_NAME_LEN 256
-#define LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN 26
+#include <stdint.h>
+
+#define LTTNG_KERNEL_ABI_SYM_NAME_LEN 256
+#define LTTNG_KERNEL_ABI_MAX_UPROBE_NUM 32
+#define LTTNG_KERNEL_ABI_SESSION_NAME_LEN 256
+#define LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN 26
/*
* LTTng DebugFS ABI structures.
*/
enum lttng_kernel_abi_instrumentation {
- LTTNG_KERNEL_ABI_ALL = -1, /* Used within lttng-tools */
- LTTNG_KERNEL_ABI_TRACEPOINT = 0,
- LTTNG_KERNEL_ABI_KPROBE = 1,
- LTTNG_KERNEL_ABI_FUNCTION = 2,
- LTTNG_KERNEL_ABI_KRETPROBE = 3,
- LTTNG_KERNEL_ABI_NOOP = 4, /* not hooked */
- LTTNG_KERNEL_ABI_SYSCALL = 5,
- LTTNG_KERNEL_ABI_UPROBE = 6,
+ LTTNG_KERNEL_ABI_ALL = -1, /* Used within lttng-tools */
+ LTTNG_KERNEL_ABI_TRACEPOINT = 0,
+ LTTNG_KERNEL_ABI_KPROBE = 1,
+ LTTNG_KERNEL_ABI_FUNCTION = 2,
+ LTTNG_KERNEL_ABI_KRETPROBE = 3,
+ LTTNG_KERNEL_ABI_NOOP = 4, /* not hooked */
+ LTTNG_KERNEL_ABI_SYSCALL = 5,
+ LTTNG_KERNEL_ABI_UPROBE = 6,
};
enum lttng_kernel_abi_context_type {
- LTTNG_KERNEL_ABI_CONTEXT_PID = 0,
+ LTTNG_KERNEL_ABI_CONTEXT_PID = 0,
LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER = 1,
- LTTNG_KERNEL_ABI_CONTEXT_PROCNAME = 2,
- LTTNG_KERNEL_ABI_CONTEXT_PRIO = 3,
- LTTNG_KERNEL_ABI_CONTEXT_NICE = 4,
- LTTNG_KERNEL_ABI_CONTEXT_VPID = 5,
- LTTNG_KERNEL_ABI_CONTEXT_TID = 6,
- LTTNG_KERNEL_ABI_CONTEXT_VTID = 7,
- LTTNG_KERNEL_ABI_CONTEXT_PPID = 8,
- LTTNG_KERNEL_ABI_CONTEXT_VPPID = 9,
- LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME = 10,
- LTTNG_KERNEL_ABI_CONTEXT_CPU_ID = 11,
- LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE = 12,
- LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE = 13,
+ LTTNG_KERNEL_ABI_CONTEXT_PROCNAME = 2,
+ LTTNG_KERNEL_ABI_CONTEXT_PRIO = 3,
+ LTTNG_KERNEL_ABI_CONTEXT_NICE = 4,
+ LTTNG_KERNEL_ABI_CONTEXT_VPID = 5,
+ LTTNG_KERNEL_ABI_CONTEXT_TID = 6,
+ LTTNG_KERNEL_ABI_CONTEXT_VTID = 7,
+ LTTNG_KERNEL_ABI_CONTEXT_PPID = 8,
+ LTTNG_KERNEL_ABI_CONTEXT_VPPID = 9,
+ LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME = 10,
+ LTTNG_KERNEL_ABI_CONTEXT_CPU_ID = 11,
+ LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE = 12,
+ LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE = 13,
LTTNG_KERNEL_ABI_CONTEXT_NEED_RESCHEDULE = 14,
- LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE = 15,
+ LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE = 15,
LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_KERNEL = 16,
- LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER = 17,
- LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS = 18,
- LTTNG_KERNEL_ABI_CONTEXT_IPC_NS = 19,
- LTTNG_KERNEL_ABI_CONTEXT_MNT_NS = 20,
- LTTNG_KERNEL_ABI_CONTEXT_NET_NS = 21,
- LTTNG_KERNEL_ABI_CONTEXT_PID_NS = 22,
- LTTNG_KERNEL_ABI_CONTEXT_USER_NS = 23,
- LTTNG_KERNEL_ABI_CONTEXT_UTS_NS = 24,
- LTTNG_KERNEL_ABI_CONTEXT_UID = 25,
- LTTNG_KERNEL_ABI_CONTEXT_EUID = 26,
- LTTNG_KERNEL_ABI_CONTEXT_SUID = 27,
- LTTNG_KERNEL_ABI_CONTEXT_GID = 28,
- LTTNG_KERNEL_ABI_CONTEXT_EGID = 29,
- LTTNG_KERNEL_ABI_CONTEXT_SGID = 30,
- LTTNG_KERNEL_ABI_CONTEXT_VUID = 31,
- LTTNG_KERNEL_ABI_CONTEXT_VEUID = 32,
- LTTNG_KERNEL_ABI_CONTEXT_VSUID = 33,
- LTTNG_KERNEL_ABI_CONTEXT_VGID = 34,
- LTTNG_KERNEL_ABI_CONTEXT_VEGID = 35,
- LTTNG_KERNEL_ABI_CONTEXT_VSGID = 36,
- LTTNG_KERNEL_ABI_CONTEXT_TIME_NS = 37,
+ LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER = 17,
+ LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS = 18,
+ LTTNG_KERNEL_ABI_CONTEXT_IPC_NS = 19,
+ LTTNG_KERNEL_ABI_CONTEXT_MNT_NS = 20,
+ LTTNG_KERNEL_ABI_CONTEXT_NET_NS = 21,
+ LTTNG_KERNEL_ABI_CONTEXT_PID_NS = 22,
+ LTTNG_KERNEL_ABI_CONTEXT_USER_NS = 23,
+ LTTNG_KERNEL_ABI_CONTEXT_UTS_NS = 24,
+ LTTNG_KERNEL_ABI_CONTEXT_UID = 25,
+ LTTNG_KERNEL_ABI_CONTEXT_EUID = 26,
+ LTTNG_KERNEL_ABI_CONTEXT_SUID = 27,
+ LTTNG_KERNEL_ABI_CONTEXT_GID = 28,
+ LTTNG_KERNEL_ABI_CONTEXT_EGID = 29,
+ LTTNG_KERNEL_ABI_CONTEXT_SGID = 30,
+ LTTNG_KERNEL_ABI_CONTEXT_VUID = 31,
+ LTTNG_KERNEL_ABI_CONTEXT_VEUID = 32,
+ LTTNG_KERNEL_ABI_CONTEXT_VSUID = 33,
+ LTTNG_KERNEL_ABI_CONTEXT_VGID = 34,
+ LTTNG_KERNEL_ABI_CONTEXT_VEGID = 35,
+ LTTNG_KERNEL_ABI_CONTEXT_VSGID = 36,
+ LTTNG_KERNEL_ABI_CONTEXT_TIME_NS = 37,
};
/* Perf counter attributes */
} LTTNG_PACKED;
/* Event/Channel context */
-#define LTTNG_KERNEL_ABI_CONTEXT_PADDING1 16
-#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
+#define LTTNG_KERNEL_ABI_CONTEXT_PADDING1 16
+#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
struct lttng_kernel_abi_context {
enum lttng_kernel_abi_context_type ctx;
char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING1];
} LTTNG_PACKED;
enum lttng_kernel_abi_syscall_entryexit {
- LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0,
- LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1,
- LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2,
+ LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0,
+ LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1,
+ LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2,
};
enum lttng_kernel_abi_syscall_abi {
- LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0,
+ LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0,
LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE = 1,
LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT = 2,
};
enum lttng_kernel_abi_syscall_match {
LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME = 0,
- LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1,
+ LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1,
};
struct lttng_kernel_abi_syscall {
- uint8_t entryexit; /* enum lttng_kernel_abi_syscall_entryexit */
- uint8_t abi; /* enum lttng_kernel_abi_syscall_abi */
- uint8_t match; /* enum lttng_kernel_abi_syscall_match */
+ uint8_t entryexit; /* enum lttng_kernel_abi_syscall_entryexit */
+ uint8_t abi; /* enum lttng_kernel_abi_syscall_abi */
+ uint8_t match; /* enum lttng_kernel_abi_syscall_match */
uint8_t padding;
- uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */
+ uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */
} LTTNG_PACKED;
/* Function tracer */
char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
} LTTNG_PACKED;
-#define LTTNG_KERNEL_ABI_EVENT_PADDING1 8
-#define LTTNG_KERNEL_ABI_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
+#define LTTNG_KERNEL_ABI_EVENT_PADDING1 8
+#define LTTNG_KERNEL_ABI_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
struct lttng_kernel_abi_event {
char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
enum lttng_kernel_abi_instrumentation instrumentation;
} u;
} LTTNG_PACKED;
-#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING 32
+#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING 32
struct lttng_kernel_abi_event_notifier {
struct lttng_kernel_abi_event event;
uint64_t error_counter_idx;
char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING];
} LTTNG_PACKED;
-#define LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX 4
+#define LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX 4
enum lttng_kernel_abi_counter_arithmetic {
LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR = 0,
uint8_t has_overflow;
} LTTNG_PACKED;
-#define LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1 67
+#define LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1 67
struct lttng_kernel_abi_counter_conf {
- uint32_t arithmetic; /* enum lttng_kernel_abi_counter_arithmetic */
- uint32_t bitness; /* enum lttng_kernel_abi_counter_bitness */
+ uint32_t arithmetic; /* enum lttng_kernel_abi_counter_arithmetic */
+ uint32_t bitness; /* enum lttng_kernel_abi_counter_bitness */
uint32_t number_dimensions;
int64_t global_sum_step;
struct lttng_kernel_abi_counter_dimension dimensions[LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX];
#define LTTNG_KERNEL_ABI_COUNTER_READ_PADDING 32
struct lttng_kernel_abi_counter_read {
struct lttng_kernel_abi_counter_index index;
- int32_t cpu; /* -1 for global counter, >= 0 for specific cpu. */
- struct lttng_kernel_abi_counter_value value; /* output */
+ int32_t cpu; /* -1 for global counter, >= 0 for specific cpu. */
+ struct lttng_kernel_abi_counter_value value; /* output */
char padding[LTTNG_KERNEL_ABI_COUNTER_READ_PADDING];
} LTTNG_PACKED;
#define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING 32
struct lttng_kernel_abi_counter_aggregate {
struct lttng_kernel_abi_counter_index index;
- struct lttng_kernel_abi_counter_value value; /* output */
+ struct lttng_kernel_abi_counter_value value; /* output */
char padding[LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING];
} LTTNG_PACKED;
char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING];
} LTTNG_PACKED;
-#define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
+#define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
struct lttng_kernel_abi_capture_bytecode {
uint32_t len;
uint32_t reloc_offset;
} LTTNG_PACKED;
struct lttng_kernel_abi_syscall_mask {
- uint32_t len; /* in bits */
+ uint32_t len; /* in bits */
char mask[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH];
} LTTNG_PACKED;
*/
#define LTTNG_KERNEL_ABI_CHANNEL_PADDING1 ((LTTNG_SYMBOL_NAME_LEN + 32))
struct lttng_kernel_abi_channel {
- uint64_t subbuf_size; /* bytes */
- uint64_t num_subbuf; /* power of 2 */
+ uint64_t subbuf_size; /* bytes */
+ uint64_t num_subbuf; /* power of 2 */
unsigned int switch_timer_interval; /* usec */
- unsigned int read_timer_interval; /* usec */
- enum lttng_event_output output; /* splice, mmap */
+ unsigned int read_timer_interval; /* usec */
+ enum lttng_event_output output; /* splice, mmap */
- int overwrite; /* 1: overwrite, 0: discard */
+ int overwrite; /* 1: overwrite, 0: discard */
char padding[LTTNG_KERNEL_ABI_CHANNEL_PADDING1];
} LTTNG_PACKED;
-#define KERNEL_FILTER_BYTECODE_MAX_LEN 65536
+#define KERNEL_FILTER_BYTECODE_MAX_LEN 65536
struct lttng_kernel_abi_filter_bytecode {
uint32_t len;
uint32_t reloc_offset;
} LTTNG_PACKED;
enum lttng_kernel_abi_tracker_type {
- LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1,
-
- LTTNG_KERNEL_ABI_TRACKER_PID = 0,
- LTTNG_KERNEL_ABI_TRACKER_VPID = 1,
- LTTNG_KERNEL_ABI_TRACKER_UID = 2,
- LTTNG_KERNEL_ABI_TRACKER_VUID = 3,
- LTTNG_KERNEL_ABI_TRACKER_GID = 4,
- LTTNG_KERNEL_ABI_TRACKER_VGID = 5,
+ LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1,
+
+ LTTNG_KERNEL_ABI_TRACKER_PID = 0,
+ LTTNG_KERNEL_ABI_TRACKER_VPID = 1,
+ LTTNG_KERNEL_ABI_TRACKER_UID = 2,
+ LTTNG_KERNEL_ABI_TRACKER_VUID = 3,
+ LTTNG_KERNEL_ABI_TRACKER_GID = 4,
+ LTTNG_KERNEL_ABI_TRACKER_VGID = 5,
};
struct lttng_kernel_abi_tracker_args {
#include <common/compat/string.hpp>
+#include <memory>
+#include <pthread.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-
-#include <memory>
-#include <pthread.h>
#include <type_traits>
/*
#ifdef NDEBUG
/*
-* Force usage of the assertion condition to prevent unused variable warnings
-* when `assert()` are disabled by the `NDEBUG` definition.
-*/
-# define LTTNG_ASSERT(_cond) ((void) sizeof((void) (_cond), 0))
+ * Force usage of the assertion condition to prevent unused variable warnings
+ * when `assert()` are disabled by the `NDEBUG` definition.
+ */
+#define LTTNG_ASSERT(_cond) ((void) sizeof((void) (_cond), 0))
#else
-# include <assert.h>
-# define LTTNG_ASSERT(_cond) assert(_cond)
+#include <assert.h>
+#define LTTNG_ASSERT(_cond) assert(_cond)
#endif
/*
* Memory allocation zeroed
*/
-static inline
-void *zmalloc_internal(size_t size)
+static inline void *zmalloc_internal(size_t size)
{
return calloc(1, size);
}
* Malloc a buffer of size `size`, asserting that AllocatedType can be safely
* malloc-ed (is trivially constructible).
*/
-template<typename AllocatedType>
+template <typename AllocatedType>
AllocatedType *malloc(size_t size)
{
- static_assert (can_malloc<AllocatedType>::value, "type can be malloc'ed");
+ static_assert(can_malloc<AllocatedType>::value, "type can be malloc'ed");
return (AllocatedType *) malloc(size);
}
* pointers to void, these will not be checked.
*/
-template<typename FreedType>
-struct can_free
-{
+template <typename FreedType>
+struct can_free {
/*
* gcc versions before 5.0 lack some type traits defined in C++11.
* Since in this instance we use the trait to prevent misuses
typename = typename std::enable_if<!can_memset<InitializedType>::value>::type>
void *memset(InitializedType *s, int c, size_t n) = delete;
-template<typename T>
-struct can_memcpy
-{
+template <typename T>
+struct can_memcpy {
/*
* gcc versions before 5.0 lack some type traits defined in C++11.
* Since in this instance we use the trait to prevent misuses
void *memmove(DestinationType *d, const SourceType *s, size_t n) = delete;
#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0])))
+#define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0])))
#endif
#ifndef LTTNG_PACKED
#endif
#ifndef LTTNG_NO_SANITIZE_ADDRESS
-#if defined(__clang__) || defined (__GNUC__)
+#if defined(__clang__) || defined(__GNUC__)
#define LTTNG_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
#define LTTNG_NO_SANITIZE_ADDRESS
#endif
#endif
-#define member_sizeof(type, field) sizeof(((type *) 0)->field)
+#define member_sizeof(type, field) sizeof(((type *) 0)->field)
-#define ASSERT_LOCKED(lock) LTTNG_ASSERT(pthread_mutex_trylock(&(lock)))
-#define ASSERT_RCU_READ_LOCKED() LTTNG_ASSERT(rcu_read_ongoing())
+#define ASSERT_LOCKED(lock) LTTNG_ASSERT(pthread_mutex_trylock(&(lock)))
+#define ASSERT_RCU_READ_LOCKED() LTTNG_ASSERT(rcu_read_ongoing())
#define ASSERT_RCU_READ_UNLOCKED() LTTNG_ASSERT(!rcu_read_ongoing())
/* Attribute suitable to tag functions as having printf()-like arguments. */
__attribute__((format(printf, _string_index, _first_to_check)))
/* Attribute suitable to tag functions as having strftime()-like arguments. */
-#define ATTR_FORMAT_STRFTIME(_string_index) \
- __attribute__((format(strftime, _string_index, 0)))
+#define ATTR_FORMAT_STRFTIME(_string_index) __attribute__((format(strftime, _string_index, 0)))
/* Macros used to ignore specific compiler diagnostics. */
#define DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
-#define DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
+#define DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
#if defined(__clang__)
- /* Clang */
-# define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT
-# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
+/* Clang */
+#define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT
+#define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
-# define DIAGNOSTIC_IGNORE_LOGICAL_OP
-# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
-# define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
- _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
+#define DIAGNOSTIC_IGNORE_LOGICAL_OP
+#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
+#define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
+_Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
#else
- /* GCC */
-# define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT \
+/* GCC */
+#define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT \
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
-# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
+#define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
-# define DIAGNOSTIC_IGNORE_LOGICAL_OP \
- _Pragma("GCC diagnostic ignored \"-Wlogical-op\"")
+#define DIAGNOSTIC_IGNORE_LOGICAL_OP _Pragma("GCC diagnostic ignored \"-Wlogical-op\"")
#if __GNUG__ && __GNUC__ >= 7
-# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES \
+#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES \
_Pragma("GCC diagnostic ignored \"-Wduplicated-branches\"")
#else
-# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
+#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES
#endif /* __GNUG__ && __GNUC__ >= 7 */
-# define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF \
- _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
+#define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
#endif
/* Used to make specific C++ functions to C code. */
#define C_LINKAGE
#endif
-/*
- * lttng_strncpy returns 0 on success, or nonzero on failure.
- * It checks that the @src string fits into @dst_len before performing
- * the copy. On failure, no copy has been performed.
- *
- * Assumes that 'src' is null-terminated.
- *
- * dst_len includes the string's trailing NULL.
- */
-static inline
-int lttng_strncpy(char *dst, const char *src, size_t dst_len)
+ /*
+ * lttng_strncpy returns 0 on success, or nonzero on failure.
+ * It checks that the @src string fits into @dst_len before performing
+ * the copy. On failure, no copy has been performed.
+ *
+ * Assumes that 'src' is null-terminated.
+ *
+ * dst_len includes the string's trailing NULL.
+ */
+ static inline int lttng_strncpy(char *dst, const char *src, size_t dst_len)
{
if (strlen(src) >= dst_len) {
/* Fail since copying would result in truncation. */
* a proper, idiomatic, wrapper.
*/
-namespace details
-{
+namespace details {
template <typename WrappedType, void (*DeleterFunction)(WrappedType *)>
struct create_unique_class {
struct deleter {
}
template <typename WrappedType, void (*DeleterFunc)(WrappedType *)>
-std::unique_ptr<WrappedType, typename details::create_unique_class<WrappedType, DeleterFunc>::deleter>
+std::unique_ptr<WrappedType,
+ typename details::create_unique_class<WrappedType, DeleterFunc>::deleter>
make_unique_wrapper(WrappedType *instance)
{
const details::create_unique_class<WrappedType, DeleterFunc> unique_deleter;
#ifndef _MI_LTTNG_H
#define _MI_LTTNG_H
-#include <stdint.h>
-
+#include <common/config/session-config.hpp>
#include <common/error.hpp>
#include <common/macros.hpp>
-#include <common/config/session-config.hpp>
+
#include <lttng/lttng.h>
+#include <stdint.h>
+
/* Don't want to reference snapshot-internal.h here */
struct lttng_snapshot_output;
};
/* Strings related to command */
-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;
-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;
-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;
-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;
-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;
+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;
+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;
+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;
+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;
+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 */
-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;
+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 */
-LTTNG_EXPORT extern const char * const mi_lttng_element_event_field;
-LTTNG_EXPORT 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 */
-LTTNG_EXPORT 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 */
-LTTNG_EXPORT 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 */
-LTTNG_EXPORT extern const char * const mi_lttng_element_save;
+LTTNG_EXPORT extern const char *const mi_lttng_element_save;
/* Strings related to load command */
-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;
+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 */
-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;
+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 */
-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;
+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 */
-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;
+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 */
-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;
+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 */
-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;
+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 */
-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;
+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 */
-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;
+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 */
-LTTNG_EXPORT 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;
+extern const char *const mi_lttng_element_session_name;
/* String related to rotate command */
-extern const char * const mi_lttng_element_rotation;
-extern const char * const mi_lttng_element_rotate_status;
-extern const char * const mi_lttng_element_rotation_schedule;
-extern const char * const mi_lttng_element_rotation_schedules;
-extern const char * const mi_lttng_element_rotation_schedule_periodic;
-extern const char * const mi_lttng_element_rotation_schedule_periodic_time_us;
-extern const char * const mi_lttng_element_rotation_schedule_size_threshold;
-extern const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes;
-extern const char * const mi_lttng_element_rotation_schedule_result;
-extern const char * const mi_lttng_element_rotation_schedule_results;
-extern const char * const mi_lttng_element_rotation_state;
-extern const char * const mi_lttng_element_rotation_location;
-extern const char * const mi_lttng_element_rotation_location_local;
-extern const char * const mi_lttng_element_rotation_location_local_absolute_path;
-extern const char * const mi_lttng_element_rotation_location_relay;
-extern const char * const mi_lttng_element_rotation_location_relay_host;
-extern const char * const mi_lttng_element_rotation_location_relay_control_port;
-extern const char * const mi_lttng_element_rotation_location_relay_data_port;
-extern const char * const mi_lttng_element_rotation_location_relay_protocol;
-extern const char * const mi_lttng_element_rotation_location_relay_relative_path;
+extern const char *const mi_lttng_element_rotation;
+extern const char *const mi_lttng_element_rotate_status;
+extern const char *const mi_lttng_element_rotation_schedule;
+extern const char *const mi_lttng_element_rotation_schedules;
+extern const char *const mi_lttng_element_rotation_schedule_periodic;
+extern const char *const mi_lttng_element_rotation_schedule_periodic_time_us;
+extern const char *const mi_lttng_element_rotation_schedule_size_threshold;
+extern const char *const mi_lttng_element_rotation_schedule_size_threshold_bytes;
+extern const char *const mi_lttng_element_rotation_schedule_result;
+extern const char *const mi_lttng_element_rotation_schedule_results;
+extern const char *const mi_lttng_element_rotation_state;
+extern const char *const mi_lttng_element_rotation_location;
+extern const char *const mi_lttng_element_rotation_location_local;
+extern const char *const mi_lttng_element_rotation_location_local_absolute_path;
+extern const char *const mi_lttng_element_rotation_location_relay;
+extern const char *const mi_lttng_element_rotation_location_relay_host;
+extern const char *const mi_lttng_element_rotation_location_relay_control_port;
+extern const char *const mi_lttng_element_rotation_location_relay_data_port;
+extern const char *const mi_lttng_element_rotation_location_relay_protocol;
+extern const char *const mi_lttng_element_rotation_location_relay_relative_path;
/* String related to enum lttng_rotation_state */
-extern const char * const mi_lttng_rotation_state_str_ongoing;
-extern const char * const mi_lttng_rotation_state_str_completed;
-extern const char * const mi_lttng_rotation_state_str_expired;
-extern const char * const mi_lttng_rotation_state_str_error;
+extern const char *const mi_lttng_rotation_state_str_ongoing;
+extern const char *const mi_lttng_rotation_state_str_completed;
+extern const char *const mi_lttng_rotation_state_str_expired;
+extern const char *const mi_lttng_rotation_state_str_error;
/* String related to enum lttng_trace_archive_location_relay_protocol_type */
-extern const char * const mi_lttng_rotation_location_relay_protocol_str_tcp;
+extern const char *const mi_lttng_rotation_location_relay_protocol_str_tcp;
/* String related to rate_policy elements */
extern const char *const mi_lttng_element_rate_policy;
extern const char *const mi_lttng_element_rate_policy_every_n;
extern const char *const mi_lttng_element_rate_policy_once_after_n;
-extern const char
- *const mi_lttng_element_rate_policy_every_n_interval;
-extern const char
- *const mi_lttng_element_rate_policy_once_after_n_threshold;
+extern const char *const mi_lttng_element_rate_policy_every_n_interval;
+extern const char *const mi_lttng_element_rate_policy_once_after_n_threshold;
/* String related to action elements */
extern const char *const mi_lttng_element_action;
extern const char *const mi_lttng_element_action_stop_session;
extern const char *const mi_lttng_element_action_rotate_session;
extern const char *const mi_lttng_element_action_snapshot_session;
-extern const char
- *const mi_lttng_element_action_snapshot_session_output;
+extern const char *const mi_lttng_element_action_snapshot_session_output;
/* String related to condition */
extern const char *const mi_lttng_element_condition;
-extern const char
- *const mi_lttng_element_condition_buffer_usage_high;
-extern const char
- *const mi_lttng_element_condition_buffer_usage_low;
-extern const char
- *const mi_lttng_element_condition_event_rule_matches;
-extern const char
- *const mi_lttng_element_condition_session_consumed_size;
-extern const char
- *const mi_lttng_element_condition_session_rotation;
-extern const char
- *const mi_lttng_element_condition_session_rotation_completed;
-extern const char
- *const mi_lttng_element_condition_session_rotation_ongoing;
+extern const char *const mi_lttng_element_condition_buffer_usage_high;
+extern const char *const mi_lttng_element_condition_buffer_usage_low;
+extern const char *const mi_lttng_element_condition_event_rule_matches;
+extern const char *const mi_lttng_element_condition_session_consumed_size;
+extern const char *const mi_lttng_element_condition_session_rotation;
+extern const char *const mi_lttng_element_condition_session_rotation_completed;
+extern const char *const mi_lttng_element_condition_session_rotation_ongoing;
extern const char *const mi_lttng_element_condition_channel_name;
extern const char *const mi_lttng_element_condition_threshold_ratio;
extern const char *const mi_lttng_element_condition_threshold_bytes;
/* String related to event expression */
extern const char *const mi_lttng_element_event_expr;
extern const char *const mi_lttng_element_event_expr_payload_field;
-extern const char
- *const mi_lttng_element_event_expr_channel_context_field;
-extern const char
- *const mi_lttng_element_event_expr_app_specific_context_field;
-extern const char
- *const mi_lttng_element_event_expr_array_field_element;
+extern const char *const mi_lttng_element_event_expr_channel_context_field;
+extern const char *const mi_lttng_element_event_expr_app_specific_context_field;
+extern const char *const mi_lttng_element_event_expr_array_field_element;
extern const char *const mi_lttng_element_event_expr_provider_name;
extern const char *const mi_lttng_element_event_expr_type_name;
/* String related to lttng_event_rule */
extern const char *const mi_lttng_element_event_rule_event_name;
extern const char *const mi_lttng_element_event_rule_name_pattern;
-extern const char
- *const mi_lttng_element_event_rule_filter_expression;
+extern const char *const mi_lttng_element_event_rule_filter_expression;
extern const char *const mi_lttng_element_event_rule_jul_logging;
extern const char *const mi_lttng_element_event_rule_kernel_kprobe;
extern const char *const mi_lttng_element_event_rule_kernel_syscall;
-extern const char
- *const mi_lttng_element_event_rule_kernel_tracepoint;
+extern const char *const mi_lttng_element_event_rule_kernel_tracepoint;
extern const char *const mi_lttng_element_event_rule_kernel_uprobe;
extern const char *const mi_lttng_element_event_rule_log4j_logging;
extern const char *const mi_lttng_element_event_rule_python_logging;
-extern const char
- *const mi_lttng_element_event_rule_user_tracepoint;
+extern const char *const mi_lttng_element_event_rule_user_tracepoint;
/* String related to lttng_event_rule_kernel_syscall. */
-extern const char
- *const mi_lttng_element_event_rule_kernel_syscall_emission_site;
+extern const char *const mi_lttng_element_event_rule_kernel_syscall_emission_site;
/* String related to enum lttng_event_rule_kernel_syscall_emission_site. */
-extern const char *const
- mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit;
-extern const char
- *const mi_lttng_event_rule_kernel_syscall_emission_site_entry;
-extern const char
- *const mi_lttng_event_rule_kernel_syscall_emission_site_exit;
-
-extern const char *const
- mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions;
-extern const char *const
- mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion;
+extern const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit;
+extern const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry;
+extern const char *const mi_lttng_event_rule_kernel_syscall_emission_site_exit;
+
+extern const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions;
+extern const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion;
/* String related to log level rule. */
extern const char *const mi_lttng_element_log_level_rule;
extern const char *const mi_lttng_element_log_level_rule_exactly;
-extern const char
- *const mi_lttng_element_log_level_rule_at_least_as_severe_as;
-extern const char *const
- mi_lttng_element_log_level_rule_at_least_as_severe_as_thre;
+extern const char *const mi_lttng_element_log_level_rule_at_least_as_severe_as;
+extern const char *const mi_lttng_element_log_level_rule_at_least_as_severe_as_thre;
extern const char *const mi_lttng_element_log_level_rule_level;
/* String related to kernel probe location. */
extern const char *const mi_lttng_element_kernel_probe_location;
-extern const char
- *const mi_lttng_element_kernel_probe_location_symbol_offset;
-extern const char *const
- mi_lttng_element_kernel_probe_location_symbol_offset_name;
-extern const char *const
- mi_lttng_element_kernel_probe_location_symbol_offset_offset;
-extern const char
- *const mi_lttng_element_kernel_probe_location_address;
-extern const char
- *const mi_lttng_element_kernel_probe_location_address_address;
+extern const char *const mi_lttng_element_kernel_probe_location_symbol_offset;
+extern const char *const mi_lttng_element_kernel_probe_location_symbol_offset_name;
+extern const char *const mi_lttng_element_kernel_probe_location_symbol_offset_offset;
+extern const char *const mi_lttng_element_kernel_probe_location_address;
+extern const char *const mi_lttng_element_kernel_probe_location_address_address;
/* String related to userspace probe location. */
extern const char *const mi_lttng_element_userspace_probe_location;
-extern const char
- *const mi_lttng_element_userspace_probe_location_binary_path;
-extern const char
- *const mi_lttng_element_userspace_probe_location_function;
-extern const char
- *const mi_lttng_element_userspace_probe_location_function_name;
-extern const char
- *const mi_lttng_element_userspace_probe_location_lookup_method;
-extern const char *const
- mi_lttng_element_userspace_probe_location_lookup_method_function_default;
-extern const char *const
- mi_lttng_element_userspace_probe_location_lookup_method_function_elf;
-extern const char *const
- mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt;
-extern const char
- *const mi_lttng_element_userspace_probe_location_tracepoint;
-extern const char *const
- mi_lttng_element_userspace_probe_location_tracepoint_probe_name;
-extern const char *const
- mi_lttng_element_userspace_probe_location_tracepoint_provider_name;
+extern const char *const mi_lttng_element_userspace_probe_location_binary_path;
+extern const char *const mi_lttng_element_userspace_probe_location_function;
+extern const char *const mi_lttng_element_userspace_probe_location_function_name;
+extern const char *const mi_lttng_element_userspace_probe_location_lookup_method;
+extern const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_default;
+extern const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_elf;
+extern const char *const mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt;
+extern const char *const mi_lttng_element_userspace_probe_location_tracepoint;
+extern const char *const mi_lttng_element_userspace_probe_location_tracepoint_probe_name;
+extern const char *const mi_lttng_element_userspace_probe_location_tracepoint_provider_name;
/* String related to enum
* lttng_userspace_probe_location_function_instrumentation_type */
-extern const char *const
- mi_lttng_element_userspace_probe_location_function_instrumentation_type;
-extern const char *const
- mi_lttng_userspace_probe_location_function_instrumentation_type_entry;
+extern const char *const mi_lttng_element_userspace_probe_location_function_instrumentation_type;
+extern const char *const mi_lttng_userspace_probe_location_function_instrumentation_type_entry;
/* String related to trigger */
extern const char *const mi_lttng_element_triggers;
/* String related to error_query. */
extern const char *const mi_lttng_element_error_query_result;
-extern const char
- *const mi_lttng_element_error_query_result_counter;
-extern const char
- *const mi_lttng_element_error_query_result_counter_value;
-extern const char
- *const mi_lttng_element_error_query_result_description;
+extern const char *const mi_lttng_element_error_query_result_counter;
+extern const char *const mi_lttng_element_error_query_result_counter_value;
+extern const char *const mi_lttng_element_error_query_result_description;
extern const char *const mi_lttng_element_error_query_result_name;
extern const char *const mi_lttng_element_error_query_result_type;
extern const char *const mi_lttng_element_error_query_results;
/* String related to add-context command */
-extern const char * const mi_lttng_element_context_symbol;
+extern const char *const mi_lttng_element_context_symbol;
/* Utility string function */
const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
const char *mi_lttng_buffertype_string(enum lttng_buffer_type value);
const char *mi_lttng_rotation_state_string(enum lttng_rotation_state value);
const char *mi_lttng_trace_archive_location_relay_protocol_type_string(
- enum lttng_trace_archive_location_relay_protocol_type value);
+ enum lttng_trace_archive_location_relay_protocol_type value);
/*
* Create an instance of a machine interface writer.
* Returns zero if the XML document could be closed cleanly.
* Negative values indicate an error.
*/
-int mi_lttng_writer_open_element(struct mi_writer *writer,
- const char *element_name);
+int mi_lttng_writer_open_element(struct mi_writer *writer, const char *element_name);
/*
* Close the current element tag.
* Returns zero if the XML document could be closed cleanly.
* Negative values indicate an error.
*/
-int mi_lttng_close_multi_element(struct mi_writer *writer,
- unsigned int nb_element);
+int mi_lttng_close_multi_element(struct mi_writer *writer, unsigned int nb_element);
/*
* Write an element of type unsigned int.
* Negative values indicate an error.
*/
int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
- const char *element_name, uint64_t value);
+ const char *element_name,
+ uint64_t value);
/*
* Write an element of type signed int.
* Negative values indicate an error.
*/
int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
- const char *element_name, int64_t value);
+ const char *element_name,
+ int64_t value);
/*
* Write an element of type boolean.
* Negative values indicate an error.
*/
int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
- const char *element_name, int value);
+ const char *element_name,
+ int value);
/*
* Write an element of type string.
* Negative values indicate an error.
*/
int mi_lttng_writer_write_element_string(struct mi_writer *writer,
- const char *element_name, const char *value);
+ const char *element_name,
+ const char *value);
/*
* Write an element of type double.
* Negative values indicate an error.
*/
int mi_lttng_writer_write_element_double(struct mi_writer *writer,
- const char *element_name,
- double value);
+ const char *element_name,
+ double value);
/*
* Machine interface of struct version.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version_data *version,
- const char *lttng_description, const char *lttng_license);
+int mi_lttng_version(struct mi_writer *writer,
+ struct mi_lttng_version_data *version,
+ const char *lttng_description,
+ const char *lttng_license);
/*
* Machine interface: open a sessions element.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_session(struct mi_writer *writer,
- struct lttng_session *session, int is_open);
+int mi_lttng_session(struct mi_writer *writer, struct lttng_session *session, int is_open);
/*
* Machine interface: open a domains element.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_domain(struct mi_writer *writer,
- struct lttng_domain *domain, int is_open);
+int mi_lttng_domain(struct mi_writer *writer, struct lttng_domain *domain, int is_open);
/*
* Machine interface: open a channels element.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_channel(struct mi_writer *writer,
- struct lttng_channel *channel, int is_open);
+int mi_lttng_channel(struct mi_writer *writer, struct lttng_channel *channel, int is_open);
/*
* Machine interface of struct channel_attr.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_channel_attr(struct mi_writer *writer,
- struct lttng_channel_attr *attr);
+int mi_lttng_channel_attr(struct mi_writer *writer, struct lttng_channel_attr *attr);
/*
-* Machine interface for event common attributes.
-*
-* writer An instance of a mi writer.
-* event single trace event.
-*
-* The common attribute are:
-* - mi event element
-* - event name
-* - event type
-* - enabled tag
-* - event filter
-*
-* Returns zero if the element's value could be written.
-* Negative values indicate an error.
-*/
-int mi_lttng_event_common_attributes(struct mi_writer *writer,
- struct lttng_event *event);
+ * Machine interface for event common attributes.
+ *
+ * writer An instance of a mi writer.
+ * event single trace event.
+ *
+ * The common attribute are:
+ * - mi event element
+ * - event name
+ * - event type
+ * - enabled tag
+ * - event filter
+ *
+ * Returns zero if the element's value could be written.
+ * Negative values indicate an error.
+ */
+int mi_lttng_event_common_attributes(struct mi_writer *writer, struct lttng_event *event);
/*
* Machine interface for kernel tracepoint event with a loglevel.
* Negative values indicate an error.
*/
int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
- struct lttng_event *event, enum lttng_domain_type domain);
+ struct lttng_event *event,
+ enum lttng_domain_type domain);
/*
* Machine interface for kernel tracepoint event with no loglevel.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
- struct lttng_event *event);
+int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer, struct lttng_event *event);
/*
* Machine interface for kernel function and probe event.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_event_function_probe(struct mi_writer *writer,
- struct lttng_event *event);
+int mi_lttng_event_function_probe(struct mi_writer *writer, struct lttng_event *event);
/*
* Machine interface for kernel function entry event.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_event_function_entry(struct mi_writer *writer,
- struct lttng_event *event);
+int mi_lttng_event_function_entry(struct mi_writer *writer, struct lttng_event *event);
/*
* Machine interface: open an events element.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
- int is_open, enum lttng_domain_type domain);
+int mi_lttng_event(struct mi_writer *writer,
+ struct lttng_event *event,
+ int is_open,
+ enum lttng_domain_type domain);
/*
* Machine interface for struct lttng_event_field.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_event_field(struct mi_writer *writer,
- struct lttng_event_field *field);
+int mi_lttng_event_field(struct mi_writer *writer, struct lttng_event_field *field);
/*
* Machine interface: open a event_fields element.
*
* Note: A targets element is also opened for each tracker definition
*/
-int mi_lttng_process_attribute_tracker_open(
- struct mi_writer *writer, enum lttng_process_attr process_attr);
+int mi_lttng_process_attribute_tracker_open(struct mi_writer *writer,
+ enum lttng_process_attr process_attr);
/*
* Machine interface: open a PIDs element.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name,
- int is_open);
+int mi_lttng_process(struct mi_writer *writer, pid_t pid, const char *name, int is_open);
/*
* TODO: move pid of lttng list -u to process semantic on mi api bump
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name,
- int is_open);
+int mi_lttng_pid(struct mi_writer *writer, pid_t pid, const char *name, int is_open);
/*
* Machine interface: open a process attribute values element.
* Negative values indicate an error.
*/
int mi_lttng_all_process_attribute_value(struct mi_writer *writer,
- enum lttng_process_attr process_attr,
- bool is_open);
+ enum lttng_process_attr process_attr,
+ bool is_open);
/*
* Machine interface for track/untrack of an integral process attribute value.
* Negative values indicate an error.
*/
int mi_lttng_integral_process_attribute_value(struct mi_writer *writer,
- enum lttng_process_attr process_attr,
- int64_t value,
- bool is_open);
+ enum lttng_process_attr process_attr,
+ int64_t value,
+ bool is_open);
/*
* Machine interface for track/untrack of a string process attribute value.
* Negative values indicate an error.
*/
int mi_lttng_string_process_attribute_value(struct mi_writer *writer,
- enum lttng_process_attr process_attr,
- const char *value,
- bool is_open);
+ enum lttng_process_attr process_attr,
+ const char *value,
+ bool is_open);
/*
* Machine interface of a context.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_context(struct mi_writer *writer,
- struct lttng_event_context *context, int is_open);
+int mi_lttng_context(struct mi_writer *writer, struct lttng_event_context *context, int is_open);
/*
* Machine interface of a perf_counter_context.
* Negative values indicate an error.
*/
int mi_lttng_perf_counter_context(struct mi_writer *writer,
- struct lttng_event_perf_counter_ctx *perf_context);
+ struct lttng_event_perf_counter_ctx *perf_context);
/*
* Machine interface of the snapshot list_output.
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
- const char *session_name);
+int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, const char *session_name);
/*
* Machine interface of the snapshot output.
* Negative values indicate an error.
*/
int mi_lttng_snapshot_list_output(struct mi_writer *writer,
- const struct lttng_snapshot_output *output);
+ const struct lttng_snapshot_output *output);
/*
* Machine interface of the output of the command snapshot del output
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
- const char *name, const char *current_session_name);
+int mi_lttng_snapshot_del_output(struct mi_writer *writer,
+ int id,
+ const char *name,
+ const char *current_session_name);
/*
* Machine interface of the output of the command snapshot add output
* Negative values indicate an error.
*/
int mi_lttng_snapshot_add_output(struct mi_writer *writer,
- const char *current_session_name, const char *n_ptr,
- struct lttng_snapshot_output *output);
+ const char *current_session_name,
+ const char *n_ptr,
+ struct lttng_snapshot_output *output);
/*
* Machine interface of the output of the command snapshot
* Returns zero if the element's value could be written.
* Negative values indicate an error.
*/
-int mi_lttng_snapshot_record(struct mi_writer *writer, const char *url,
- const char *cmdline_ctrl_url, const char *cmdline_data_url);
+int mi_lttng_snapshot_record(struct mi_writer *writer,
+ const char *url,
+ const char *cmdline_ctrl_url,
+ const char *cmdline_data_url);
/*
* Machine interface representation of a session rotation schedule.
* Negative values indicate an error.
*/
int mi_lttng_rotation_schedule(struct mi_writer *writer,
- const struct lttng_rotation_schedule *schedule);
+ const struct lttng_rotation_schedule *schedule);
/*
* Machine interface of a session rotation schedule result.
* Negative values indicate an error.
*/
int mi_lttng_rotation_schedule_result(struct mi_writer *writer,
- const struct lttng_rotation_schedule *schedule,
- bool success);
+ const struct lttng_rotation_schedule *schedule,
+ bool success);
/*
* Machine interface of a session rotation result.
* Negative values indicate an error.
*/
int mi_lttng_rotate(struct mi_writer *writer,
- const char *session_name,
- enum lttng_rotation_state rotation_state,
- const struct lttng_trace_archive_location *location);
+ const char *session_name,
+ enum lttng_rotation_state rotation_state,
+ const struct lttng_trace_archive_location *location);
#endif /* _MI_LTTNG_H */
*
* LTTNG_OPTIONAL_UNSET(&foo.b);
*/
-#define LTTNG_OPTIONAL(type) \
- struct { \
+#define LTTNG_OPTIONAL(type) \
+ struct { \
uint8_t is_set; \
- type value; \
+ type value; \
}
/*
* Since this returns the 'optional' by value, it is not suitable for all
* wrapped optional types. It is meant to be used with PODs.
*/
-#define LTTNG_OPTIONAL_GET(optional) \
- ({ \
- LTTNG_ASSERT((optional).is_set); \
- (optional).value; \
+#define LTTNG_OPTIONAL_GET(optional) \
+ ({ \
+ LTTNG_ASSERT((optional).is_set); \
+ (optional).value; \
})
/*
* an optional value is set to LTTNG_ASSERT() that it is set when fecthing the
* underlying value's address.
*/
-#define LTTNG_OPTIONAL_GET_PTR(optional) \
- ({ \
- LTTNG_ASSERT((optional).is_set); \
- &(optional).value; \
+#define LTTNG_OPTIONAL_GET_PTR(optional) \
+ ({ \
+ LTTNG_ASSERT((optional).is_set); \
+ &(optional).value; \
})
/*
* The wrapped field is set to the value it would gave if it had static storage
* duration.
*/
-#define LTTNG_OPTIONAL_INIT_UNSET {}
+#define LTTNG_OPTIONAL_INIT_UNSET \
+ { \
+ }
/*
* Initialize an optional field as 'set' with a given value.
}
/* Set the value of an optional field. */
-#define LTTNG_OPTIONAL_SET(field_ptr, val) \
- do { \
- (field_ptr)->is_set = 1; \
- (field_ptr)->value = (val); \
+#define LTTNG_OPTIONAL_SET(field_ptr, val) \
+ do { \
+ (field_ptr)->is_set = 1; \
+ (field_ptr)->value = (val); \
} while (0)
/* Put an optional field in the "unset" (NULL-ed) state. */
-#define LTTNG_OPTIONAL_UNSET(field_ptr) \
- do { \
- (field_ptr)->is_set = 0; \
+#define LTTNG_OPTIONAL_UNSET(field_ptr) \
+ do { \
+ (field_ptr)->is_set = 0; \
} while (0)
#endif /* LTTNG_OPTIONAL_H */
* cause the view to reference the whole payload from the
* offset provided.
*/
-struct lttng_payload_view lttng_payload_view_from_payload(
- const struct lttng_payload *payload, size_t offset,
- ptrdiff_t len);
+struct lttng_payload_view
+lttng_payload_view_from_payload(const struct lttng_payload *payload, size_t offset, ptrdiff_t len);
/**
* Return a payload view referencing a subset of a payload referenced by
* cause the payload view to reference the whole payload view's
* buffer view from the offset provided.
*/
-struct lttng_payload_view lttng_payload_view_from_view(
- struct lttng_payload_view *view, size_t offset,
- ptrdiff_t len);
+struct lttng_payload_view
+lttng_payload_view_from_view(struct lttng_payload_view *view, size_t offset, ptrdiff_t len);
/**
* Return a payload view referencing a subset of a dynamic buffer.
* offset provided.
*/
struct lttng_payload_view lttng_payload_view_from_dynamic_buffer(
- const struct lttng_dynamic_buffer *buffer, size_t offset,
- ptrdiff_t len);
+ const struct lttng_dynamic_buffer *buffer, size_t offset, ptrdiff_t len);
/**
*
* Return a payload view referencing a subset of a dynamic buffer.
* cause the payload view to reference the whole payload from the
* offset provided.
*/
-struct lttng_payload_view lttng_payload_view_from_buffer_view(
- const struct lttng_buffer_view *view, size_t offset,
- ptrdiff_t len);
+struct lttng_payload_view lttng_payload_view_from_buffer_view(const struct lttng_buffer_view *view,
+ size_t offset,
+ ptrdiff_t len);
/**
* Return a payload view referencing a subset of the memory referenced by a raw
* Note that a payload view never assumes the ownership of the memory it
* references.
*/
-struct lttng_payload_view lttng_payload_view_init_from_buffer(
- const char *src, size_t offset, ptrdiff_t len);
+struct lttng_payload_view
+lttng_payload_view_init_from_buffer(const char *src, size_t offset, ptrdiff_t len);
/**
* Get the number of file descriptor handles left in a payload view.
*
* Returns the number of file descriptor handles left on success, -1 on error.
*/
-int lttng_payload_view_get_fd_handle_count(
- const struct lttng_payload_view *payload_view);
+int lttng_payload_view_get_fd_handle_count(const struct lttng_payload_view *payload_view);
/**
* Pop an fd handle from a payload view.
*
* Returns an fd_handle on success, -1 on error.
*/
-struct fd_handle *lttng_payload_view_pop_fd_handle(
- struct lttng_payload_view *payload_view);
+struct fd_handle *lttng_payload_view_pop_fd_handle(struct lttng_payload_view *payload_view);
#endif /* LTTNG_PAYLOAD_VIEW_H */
#ifndef LTTNG_PAYLOAD_H
#define LTTNG_PAYLOAD_H
-#include <common/dynamic-buffer.hpp>
#include <common/dynamic-array.hpp>
+#include <common/dynamic-buffer.hpp>
#include <common/fd-handle.hpp>
/*
void lttng_payload_init(struct lttng_payload *payload);
/* Copy a payload. */
-int lttng_payload_copy(const struct lttng_payload *src_payload,
- struct lttng_payload *dst_payload);
+int lttng_payload_copy(const struct lttng_payload *src_payload, struct lttng_payload *dst_payload);
/* Release any memory and references held by the payload. */
void lttng_payload_reset(struct lttng_payload *payload);
*
* Returns 0 on success, -1 on allocation error.
*/
-int lttng_payload_push_fd_handle(struct lttng_payload *payload,
- struct fd_handle *fd_handle);
+int lttng_payload_push_fd_handle(struct lttng_payload *payload, struct fd_handle *fd_handle);
#endif /* LTTNG_PAYLOAD_H */
}
struct lttng_pipe *lttng_pipe_open(int flags);
-struct lttng_pipe *lttng_pipe_named_open(const char *path, mode_t mode,
- int flags);
+struct lttng_pipe *lttng_pipe_named_open(const char *path, mode_t mode, int flags);
int lttng_pipe_write_close(struct lttng_pipe *pipe);
int lttng_pipe_read_close(struct lttng_pipe *pipe);
void lttng_pipe_destroy(struct lttng_pipe *pipe);
ssize_t lttng_pipe_read(struct lttng_pipe *pipe, void *buf, size_t count);
-ssize_t lttng_pipe_write(struct lttng_pipe *pipe, const void *buf,
- size_t count);
+ssize_t lttng_pipe_write(struct lttng_pipe *pipe, const void *buf, size_t count);
/* Returns and releases the read end of the pipe. */
int lttng_pipe_release_readfd(struct lttng_pipe *pipe);
/* Returns and releases the write end of the pipe. */
#include <common/exception.hpp>
-#include <pthread.h>
#include <mutex>
+#include <pthread.h>
namespace lttng {
namespace pthread {
}
}
#else /* defined(__linux__) && defined(SYS_getrandom) && defined(HAVE_SYS_RANDOM_H) */
-__attribute__((noreturn))
-void getrandom_nonblock(char *out_data __attribute__((unused)),
- std::size_t size __attribute__((unused)))
+__attribute__((noreturn)) void getrandom_nonblock(char *out_data __attribute__((unused)),
+ std::size_t size __attribute__((unused)))
{
LTTNG_THROW_RANDOM_PRODUCTION_ERROR("getrandom() is not supported by this platform");
}
class production_error : public ::lttng::runtime_error {
public:
explicit production_error(const std::string& msg,
- const char *file_name,
- const char *function_name,
- unsigned int line_number);
+ const char *file_name,
+ const char *function_name,
+ unsigned int line_number);
};
/*
*
*/
-#include <unistd.h>
#include <common/macros.hpp>
+#include <unistd.h>
+
/*
* lttng_read and lttng_write take care of EINTR and partial read/write.
* Upon success, they return the "count" received as parameter.
#ifndef _RELAYD_H
#define _RELAYD_H
-#include <unistd.h>
-#include <stdbool.h>
-
+#include <common/dynamic-array.hpp>
#include <common/sessiond-comm/relayd.hpp>
#include <common/sessiond-comm/sessiond-comm.hpp>
#include <common/trace-chunk.hpp>
-#include <common/dynamic-array.hpp>
+
+#include <stdbool.h>
+#include <unistd.h>
struct relayd_stream_rotation_position {
uint64_t stream_id;
int relayd_connect(struct lttcomm_relayd_sock *sock);
int relayd_close(struct lttcomm_relayd_sock *sock);
int relayd_create_session(struct lttcomm_relayd_sock *rsock,
- uint64_t *relayd_session_id,
- const char *session_name, const char *hostname,
- const char *base_path, int session_live_timer,
- unsigned int snapshot, uint64_t sessiond_session_id,
- const lttng_uuid& sessiond_uuid,
- const uint64_t *current_chunk_id,
- time_t creation_time, bool session_name_contains_creation_time,
- char *output_path);
-int relayd_add_stream(struct lttcomm_relayd_sock *sock, const char *channel_name,
- const char *domain_name, const char *pathname, uint64_t *stream_id,
- uint64_t tracefile_size, uint64_t tracefile_count,
- struct lttng_trace_chunk *trace_chunk);
+ uint64_t *relayd_session_id,
+ const char *session_name,
+ const char *hostname,
+ const char *base_path,
+ int session_live_timer,
+ unsigned int snapshot,
+ uint64_t sessiond_session_id,
+ const lttng_uuid& sessiond_uuid,
+ const uint64_t *current_chunk_id,
+ time_t creation_time,
+ bool session_name_contains_creation_time,
+ char *output_path);
+int relayd_add_stream(struct lttcomm_relayd_sock *sock,
+ const char *channel_name,
+ const char *domain_name,
+ const char *pathname,
+ uint64_t *stream_id,
+ uint64_t tracefile_size,
+ uint64_t tracefile_count,
+ struct lttng_trace_chunk *trace_chunk);
int relayd_streams_sent(struct lttcomm_relayd_sock *rsock);
-int relayd_send_close_stream(struct lttcomm_relayd_sock *sock, uint64_t stream_id,
- uint64_t last_net_seq_num);
+int relayd_send_close_stream(struct lttcomm_relayd_sock *sock,
+ uint64_t stream_id,
+ uint64_t last_net_seq_num);
int relayd_version_check(struct lttcomm_relayd_sock *sock);
int relayd_start_data(struct lttcomm_relayd_sock *sock);
int relayd_send_metadata(struct lttcomm_relayd_sock *sock, size_t len);
int relayd_send_data_hdr(struct lttcomm_relayd_sock *sock,
- struct lttcomm_relayd_data_hdr *hdr, size_t size);
-int relayd_data_pending(struct lttcomm_relayd_sock *sock, uint64_t stream_id,
- uint64_t last_net_seq_num);
-int relayd_quiescent_control(struct lttcomm_relayd_sock *sock,
- uint64_t metadata_stream_id);
+ struct lttcomm_relayd_data_hdr *hdr,
+ size_t size);
+int relayd_data_pending(struct lttcomm_relayd_sock *sock,
+ uint64_t stream_id,
+ uint64_t last_net_seq_num);
+int relayd_quiescent_control(struct lttcomm_relayd_sock *sock, uint64_t metadata_stream_id);
int relayd_begin_data_pending(struct lttcomm_relayd_sock *sock, uint64_t id);
-int relayd_end_data_pending(struct lttcomm_relayd_sock *sock, uint64_t id,
- unsigned int *is_data_inflight);
+int relayd_end_data_pending(struct lttcomm_relayd_sock *sock,
+ uint64_t id,
+ unsigned int *is_data_inflight);
int relayd_send_index(struct lttcomm_relayd_sock *rsock,
- struct ctf_packet_index *index, uint64_t relay_stream_id,
- uint64_t net_seq_num);
-int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock,
- uint64_t stream_id, uint64_t version);
+ struct ctf_packet_index *index,
+ uint64_t relay_stream_id,
+ uint64_t net_seq_num);
+int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock, uint64_t stream_id, uint64_t version);
/* `positions` is an array of `stream_count` relayd_stream_rotation_position. */
int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
- unsigned int stream_count, const uint64_t *new_chunk_id,
- const struct relayd_stream_rotation_position *positions);
-int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock,
- struct lttng_trace_chunk *chunk);
+ unsigned int stream_count,
+ const uint64_t *new_chunk_id,
+ const struct relayd_stream_rotation_position *positions);
+int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock, struct lttng_trace_chunk *chunk);
int relayd_close_trace_chunk(struct lttcomm_relayd_sock *sock,
- struct lttng_trace_chunk *chunk,
- char *path);
+ struct lttng_trace_chunk *chunk,
+ char *path);
int relayd_trace_chunk_exists(struct lttcomm_relayd_sock *sock,
- uint64_t chunk_id, bool *chunk_exists);
+ uint64_t chunk_id,
+ bool *chunk_exists);
int relayd_get_configuration(struct lttcomm_relayd_sock *sock,
- uint64_t query_flags,
- uint64_t *result_flags);
+ uint64_t query_flags,
+ uint64_t *result_flags);
#endif /* _RELAYD_H */
*
*/
+#include <common/macros.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
-#include <common/macros.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-
/*
* The run-as process is launched by forking without an exec*() call. This means
* that any resource allocated before the run-as worker is launched should be
using post_fork_cleanup_cb = int (*)(void *);
int run_as_mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid);
-int run_as_mkdirat_recursive(int dirfd, const char *path, mode_t mode,
- uid_t uid, gid_t gid);
+int run_as_mkdirat_recursive(int dirfd, const char *path, mode_t mode, uid_t uid, gid_t gid);
int run_as_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid);
-int run_as_mkdirat(int dirfd, const char *path, mode_t mode,
- uid_t uid, gid_t gid);
+int run_as_mkdirat(int dirfd, const char *path, mode_t mode, uid_t uid, gid_t gid);
int run_as_open(const char *path, int flags, mode_t mode, uid_t uid, gid_t gid);
-int run_as_openat(int dirfd, const char *filename, int flags, mode_t mode,
- uid_t uid, gid_t gid);
+int run_as_openat(int dirfd, const char *filename, int flags, mode_t mode, uid_t uid, gid_t gid);
int run_as_unlink(const char *path, uid_t uid, gid_t gid);
int run_as_unlinkat(int dirfd, const char *filename, uid_t uid, gid_t gid);
int run_as_rmdir(const char *path, uid_t uid, gid_t gid);
int run_as_rmdirat(int dirfd, const char *path, uid_t uid, gid_t gid);
int run_as_rmdirat_recursive(int dirfd, const char *path, uid_t uid, gid_t gid, int flags);
int run_as_rename(const char *old_name, const char *new_name, uid_t uid, gid_t gid);
-int run_as_renameat(int old_dirfd, const char *old_name,
- int new_dirfd, const char *new_name, uid_t uid, gid_t gid);
-int run_as_extract_elf_symbol_offset(int fd, const char* function,
- uid_t uid, gid_t gid, uint64_t *offset);
-int run_as_extract_sdt_probe_offsets(int fd, const char *provider_name,
- const char* probe_name, uid_t uid, gid_t gid,
- uint64_t **offsets, uint32_t *num_offset);
+int run_as_renameat(int old_dirfd,
+ const char *old_name,
+ int new_dirfd,
+ const char *new_name,
+ uid_t uid,
+ gid_t gid);
+int run_as_extract_elf_symbol_offset(
+ int fd, const char *function, uid_t uid, gid_t gid, uint64_t *offset);
+int run_as_extract_sdt_probe_offsets(int fd,
+ const char *provider_name,
+ const char *probe_name,
+ uid_t uid,
+ gid_t gid,
+ uint64_t **offsets,
+ uint32_t *num_offset);
int run_as_generate_filter_bytecode(const char *filter_expression,
- const struct lttng_credentials *creds,
- struct lttng_bytecode **bytecode);
+ const struct lttng_credentials *creds,
+ struct lttng_bytecode **bytecode);
int run_as_create_worker(const char *procname,
- post_fork_cleanup_cb clean_up_func, void *clean_up_user_data);
+ post_fork_cleanup_cb clean_up_func,
+ void *clean_up_user_data);
void run_as_destroy_worker();
#endif /* _RUNAS_H */
#ifndef AGENT_COMM
#define AGENT_COMM
-#include <stdint.h>
-
#include <common/compiler.hpp>
#include <common/macros.hpp>
+
#include <lttng/lttng.h>
+#include <stdint.h>
+
/*
* Command value passed in the header.
*/
enum lttcomm_agent_command {
- AGENT_CMD_LIST = 1,
- AGENT_CMD_ENABLE = 2,
- AGENT_CMD_DISABLE = 3,
- AGENT_CMD_REG_DONE = 4, /* End registration process. */
- AGENT_CMD_APP_CTX_ENABLE = 5,
- AGENT_CMD_APP_CTX_DISABLE = 6,
+ AGENT_CMD_LIST = 1,
+ AGENT_CMD_ENABLE = 2,
+ AGENT_CMD_DISABLE = 3,
+ AGENT_CMD_REG_DONE = 4, /* End registration process. */
+ AGENT_CMD_APP_CTX_ENABLE = 5,
+ AGENT_CMD_APP_CTX_DISABLE = 6,
};
/*
*/
enum lttcomm_agent_ret_code {
/* Success, assumed to be the first entry */
- AGENT_RET_CODE_SUCCESS = 1,
+ AGENT_RET_CODE_SUCCESS = 1,
/* Invalid command */
- AGENT_RET_CODE_INVALID = 2,
+ AGENT_RET_CODE_INVALID = 2,
/* Unknown logger name */
- AGENT_RET_CODE_UNKNOWN_NAME = 3,
+ AGENT_RET_CODE_UNKNOWN_NAME = 3,
AGENT_RET_CODE_NR,
};
* Agent application communication header.
*/
struct lttcomm_agent_hdr {
- uint64_t data_size; /* data size following this header */
- uint32_t cmd; /* Enum of agent command. */
- uint32_t cmd_version; /* command version */
+ uint64_t data_size; /* data size following this header */
+ uint32_t cmd; /* Enum of agent command. */
+ uint32_t cmd_version; /* command version */
} LTTNG_PACKED;
/*
char payload[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH];
} LTTNG_PACKED;
-#endif /* AGENT_COMM */
+#endif /* AGENT_COMM */
#ifndef _LTTCOMM_INET_H
#define _LTTCOMM_INET_H
-#include <limits.h>
-
#include "sessiond-comm.hpp"
+#include <lttng/lttng-export.h>
+
+#include <limits.h>
+#include <sys/types.h>
+
/* See man tcp(7) for more detail about this value. */
#define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries"
#define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout"
* (180/5) by considering that it grows linearly. This is of course uncertain
* but this is the best approximation we can do at runtime.
*/
-#define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36
+#define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36
/*
* Maximum timeout value in seconds of a TCP connection for both send/recv and
struct lttcomm_sock;
/* Net family callback */
-extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type,
- int proto);
+extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type, int proto);
extern struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock);
extern int lttcomm_bind_inet_sock(struct lttcomm_sock *sock);
extern int lttcomm_connect_inet_sock(struct lttcomm_sock *sock);
extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog);
-extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
- size_t len, int flags);
-extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock,
- const void *buf, size_t len, int flags);
+extern ssize_t
+lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags);
+extern ssize_t
+lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags);
/* Initialize inet communication layer. */
extern void lttcomm_inet_init();
-#endif /* _LTTCOMM_INET_H */
+#endif /* _LTTCOMM_INET_H */
#ifndef _LTTCOMM_INET6_H
#define _LTTCOMM_INET6_H
-#include <limits.h>
-
#include "sessiond-comm.hpp"
+#include <limits.h>
+#include <sys/types.h>
+
/* Stub */
struct lttcomm_sock;
/* Net family callback */
-extern int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type,
- int proto);
+extern int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto);
-extern struct lttcomm_sock *lttcomm_accept_inet6_sock(
- struct lttcomm_sock *sock);
+extern struct lttcomm_sock *lttcomm_accept_inet6_sock(struct lttcomm_sock *sock);
extern int lttcomm_bind_inet6_sock(struct lttcomm_sock *sock);
extern int lttcomm_close_inet6_sock(struct lttcomm_sock *sock);
extern int lttcomm_connect_inet6_sock(struct lttcomm_sock *sock);
extern int lttcomm_listen_inet6_sock(struct lttcomm_sock *sock, int backlog);
-extern ssize_t lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf,
- size_t len, int flags);
-extern ssize_t lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock,
- const void *buf, size_t len, int flags);
+extern ssize_t
+lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags);
+extern ssize_t
+lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags);
-#endif /* _LTTCOMM_INET6_H */
+#endif /* _LTTCOMM_INET6_H */
#ifndef _RELAYD_COMM
#define _RELAYD_COMM
-#include <limits.h>
-#include <stdint.h>
-
-#include <lttng/lttng.h>
#include <common/compiler.hpp>
#include <common/defaults.hpp>
#include <common/index/ctf-index.hpp>
#include <common/macros.hpp>
-#include <common/uuid.hpp>
#include <common/optional.hpp>
+#include <common/uuid.hpp>
+
+#include <lttng/lttng.h>
+
+#include <limits.h>
+#include <stdint.h>
-#define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR
-#define RELAYD_VERSION_COMM_MINOR VERSION_MINOR
+#define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR
+#define RELAYD_VERSION_COMM_MINOR VERSION_MINOR
-#define RELAYD_COMM_LTTNG_HOST_NAME_MAX_2_4 64
-#define RELAYD_COMM_LTTNG_NAME_MAX_2_4 255
-#define RELAYD_COMM_LTTNG_PATH_MAX 4096
-#define RELAYD_COMM_DEFAULT_STREAM_NAME_LEN 264 /* 256 + 8 */
+#define RELAYD_COMM_LTTNG_HOST_NAME_MAX_2_4 64
+#define RELAYD_COMM_LTTNG_NAME_MAX_2_4 255
+#define RELAYD_COMM_LTTNG_PATH_MAX 4096
+#define RELAYD_COMM_DEFAULT_STREAM_NAME_LEN 264 /* 256 + 8 */
/*
* lttng-relayd communication header.
struct lttcomm_relayd_hdr {
/* Circuit ID not used for now so always ignored */
uint64_t circuit_id;
- uint64_t data_size; /* data size following this header */
- uint32_t cmd; /* enum lttcomm_relayd_command */
- uint32_t cmd_version; /* command version */
+ uint64_t data_size; /* data size following this header */
+ uint32_t cmd; /* enum lttcomm_relayd_command */
+ uint32_t cmd_version; /* command version */
} LTTNG_PACKED;
/*
struct lttcomm_relayd_data_hdr {
/* Circuit ID not used for now so always ignored */
uint64_t circuit_id;
- uint64_t stream_id; /* Stream ID known by the relayd */
- uint64_t net_seq_num; /* Network sequence number, per stream. */
- uint32_t data_size; /* data size following this header */
- uint32_t padding_size; /* Size of 0 padding the data */
+ uint64_t stream_id; /* Stream ID known by the relayd */
+ uint64_t net_seq_num; /* Network sequence number, per stream. */
+ uint32_t data_size; /* data size following this header */
+ uint32_t padding_size; /* Size of 0 padding the data */
} LTTNG_PACKED;
/*
*/
struct lttcomm_relayd_close_stream {
uint64_t stream_id;
- uint64_t last_net_seq_num; /* sequence number of last packet */
+ uint64_t last_net_seq_num; /* sequence number of last packet */
} LTTNG_PACKED;
/*
if (major == 1) {
switch (minor) {
case 0:
- return offsetof(struct lttcomm_relayd_index, stream_id)
- + member_sizeof(struct lttcomm_relayd_index,
- stream_id);
+ return offsetof(struct lttcomm_relayd_index, stream_id) +
+ member_sizeof(struct lttcomm_relayd_index, stream_id);
case 1:
- return offsetof(struct lttcomm_relayd_index, packet_seq_num)
- + member_sizeof(struct lttcomm_relayd_index,
- packet_seq_num);
+ return offsetof(struct lttcomm_relayd_index, packet_seq_num) +
+ member_sizeof(struct lttcomm_relayd_index, packet_seq_num);
default:
abort();
}
char payload[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH];
} LTTNG_PACKED;
-#endif /* _RELAYD_COMM */
+#endif /* _RELAYD_COMM */
#ifndef _LTTNG_SESSIOND_COMM_H
#define _LTTNG_SESSIOND_COMM_H
-#include <limits.h>
-#include <lttng/lttng.h>
-#include <lttng/snapshot-internal.hpp>
-#include <lttng/save-internal.hpp>
-#include <lttng/channel-internal.hpp>
-#include <lttng/trigger/trigger-internal.hpp>
-#include <lttng/rotate-internal.hpp>
+#include "inet.hpp"
+#include "inet6.hpp"
+
#include <common/compat/socket.hpp>
#include <common/compiler.hpp>
-#include <common/uri.hpp>
#include <common/defaults.hpp>
-#include <common/uuid.hpp>
#include <common/macros.hpp>
#include <common/optional.hpp>
+#include <common/unix.hpp>
+#include <common/uri.hpp>
+#include <common/uuid.hpp>
+
+#include <lttng/channel-internal.hpp>
+#include <lttng/lttng.h>
+#include <lttng/rotate-internal.hpp>
+#include <lttng/save-internal.hpp>
+#include <lttng/snapshot-internal.hpp>
+#include <lttng/trigger/trigger-internal.hpp>
#include <arpa/inet.h>
+#include <limits.h>
#include <netinet/in.h>
#include <stdint.h>
#include <sys/un.h>
-#include "inet.hpp"
-#include "inet6.hpp"
-#include <common/unix.hpp>
-
/* Queue size of listen(2) */
#define LTTNG_SESSIOND_COMM_MAX_LISTEN 64
/* Maximum number of FDs that can be sent over a Unix socket */
#if defined(__linux__)
/* Based on the kernel's SCM_MAX_FD which is 253 since 2.6.38 (255 before) */
-#define LTTCOMM_MAX_SEND_FDS 253
+#define LTTCOMM_MAX_SEND_FDS 253
#else
-#define LTTCOMM_MAX_SEND_FDS 16
+#define LTTCOMM_MAX_SEND_FDS 16
#endif
enum lttcomm_sessiond_command {
LTTCOMM_SESSIOND_COMMAND_MAX,
};
-static inline
-bool lttcomm_sessiond_command_is_valid(enum lttcomm_sessiond_command cmd)
+static inline bool lttcomm_sessiond_command_is_valid(enum lttcomm_sessiond_command cmd)
{
return cmd > LTTCOMM_SESSIOND_COMMAND_MIN && cmd < LTTCOMM_SESSIOND_COMMAND_MAX;
}
-static inline
-const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd)
+static inline const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd)
{
switch (cmd) {
case LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT:
}
enum lttcomm_relayd_command {
- RELAYD_ADD_STREAM = 1,
- RELAYD_CREATE_SESSION = 2,
- RELAYD_START_DATA = 3,
- RELAYD_UPDATE_SYNC_INFO = 4,
- RELAYD_VERSION = 5,
- RELAYD_SEND_METADATA = 6,
- RELAYD_CLOSE_STREAM = 7,
- RELAYD_DATA_PENDING = 8,
- RELAYD_QUIESCENT_CONTROL = 9,
- RELAYD_BEGIN_DATA_PENDING = 10,
- RELAYD_END_DATA_PENDING = 11,
- RELAYD_ADD_INDEX = 12,
- RELAYD_SEND_INDEX = 13,
- RELAYD_CLOSE_INDEX = 14,
+ RELAYD_ADD_STREAM = 1,
+ RELAYD_CREATE_SESSION = 2,
+ RELAYD_START_DATA = 3,
+ RELAYD_UPDATE_SYNC_INFO = 4,
+ RELAYD_VERSION = 5,
+ RELAYD_SEND_METADATA = 6,
+ RELAYD_CLOSE_STREAM = 7,
+ RELAYD_DATA_PENDING = 8,
+ RELAYD_QUIESCENT_CONTROL = 9,
+ RELAYD_BEGIN_DATA_PENDING = 10,
+ RELAYD_END_DATA_PENDING = 11,
+ RELAYD_ADD_INDEX = 12,
+ RELAYD_SEND_INDEX = 13,
+ RELAYD_CLOSE_INDEX = 14,
/* Live-reading commands (2.4+). */
- RELAYD_LIST_SESSIONS = 15,
+ RELAYD_LIST_SESSIONS = 15,
/* All streams of the channel have been sent to the relayd (2.4+). */
- RELAYD_STREAMS_SENT = 16,
+ RELAYD_STREAMS_SENT = 16,
/* Ask the relay to reset the metadata trace file (2.8+) */
- RELAYD_RESET_METADATA = 17,
+ RELAYD_RESET_METADATA = 17,
/* Ask the relay to rotate a set of stream files (2.11+) */
- RELAYD_ROTATE_STREAMS = 18,
+ RELAYD_ROTATE_STREAMS = 18,
/* Ask the relay to create a trace chunk (2.11+) */
- RELAYD_CREATE_TRACE_CHUNK = 19,
+ RELAYD_CREATE_TRACE_CHUNK = 19,
/* Ask the relay to close a trace chunk (2.11+) */
- RELAYD_CLOSE_TRACE_CHUNK = 20,
+ RELAYD_CLOSE_TRACE_CHUNK = 20,
/* Ask the relay whether a trace chunk exists (2.11+) */
- RELAYD_TRACE_CHUNK_EXISTS = 21,
+ RELAYD_TRACE_CHUNK_EXISTS = 21,
/* Get the current configuration of a relayd peer (2.12+) */
- RELAYD_GET_CONFIGURATION = 22,
+ RELAYD_GET_CONFIGURATION = 22,
/* Feature branch specific commands start at 10000. */
};
-static inline
-const char *lttcomm_relayd_command_str(lttcomm_relayd_command cmd)
+static inline const char *lttcomm_relayd_command_str(lttcomm_relayd_command cmd)
{
switch (cmd) {
case RELAYD_ADD_STREAM:
* lttcomm error code.
*/
enum lttcomm_return_code {
- LTTCOMM_CONSUMERD_SUCCESS = 0, /* Everything went fine. */
+ LTTCOMM_CONSUMERD_SUCCESS = 0, /* Everything went fine. */
/*
* Some code paths use -1 to express an error, others
* negate this consumer return code. Starting codes at
* and legitimate status codes.
*/
LTTCOMM_CONSUMERD_COMMAND_SOCK_READY = 100, /* Command socket ready */
- LTTCOMM_CONSUMERD_SUCCESS_RECV_FD, /* Success on receiving fds */
- LTTCOMM_CONSUMERD_ERROR_RECV_FD, /* Error on receiving fds */
- LTTCOMM_CONSUMERD_ERROR_RECV_CMD, /* Error on receiving command */
- LTTCOMM_CONSUMERD_POLL_ERROR, /* Error in polling thread */
- LTTCOMM_CONSUMERD_POLL_NVAL, /* Poll on closed fd */
- LTTCOMM_CONSUMERD_POLL_HUP, /* All fds have hungup */
- LTTCOMM_CONSUMERD_EXIT_SUCCESS, /* Consumerd exiting normally */
- LTTCOMM_CONSUMERD_EXIT_FAILURE, /* Consumerd exiting on error */
- LTTCOMM_CONSUMERD_OUTFD_ERROR, /* Error opening the tracefile */
- LTTCOMM_CONSUMERD_SPLICE_EBADF, /* EBADF from splice(2) */
- LTTCOMM_CONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */
- LTTCOMM_CONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */
- LTTCOMM_CONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */
- LTTCOMM_CONSUMERD_ENOMEM, /* Consumer is out of memory */
- LTTCOMM_CONSUMERD_ERROR_METADATA, /* Error with metadata. */
- LTTCOMM_CONSUMERD_FATAL, /* Fatal error. */
- LTTCOMM_CONSUMERD_RELAYD_FAIL, /* Error on remote relayd */
- LTTCOMM_CONSUMERD_CHANNEL_FAIL, /* Channel creation failed. */
- LTTCOMM_CONSUMERD_CHAN_NOT_FOUND, /* Channel not found. */
- LTTCOMM_CONSUMERD_ALREADY_SET, /* Resource already set. */
- LTTCOMM_CONSUMERD_ROTATION_FAIL, /* Rotation has failed. */
- LTTCOMM_CONSUMERD_SNAPSHOT_FAILED, /* snapshot has failed. */
- LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED,/* Trace chunk creation failed. */
+ LTTCOMM_CONSUMERD_SUCCESS_RECV_FD, /* Success on receiving fds */
+ LTTCOMM_CONSUMERD_ERROR_RECV_FD, /* Error on receiving fds */
+ LTTCOMM_CONSUMERD_ERROR_RECV_CMD, /* Error on receiving command */
+ LTTCOMM_CONSUMERD_POLL_ERROR, /* Error in polling thread */
+ LTTCOMM_CONSUMERD_POLL_NVAL, /* Poll on closed fd */
+ LTTCOMM_CONSUMERD_POLL_HUP, /* All fds have hungup */
+ LTTCOMM_CONSUMERD_EXIT_SUCCESS, /* Consumerd exiting normally */
+ LTTCOMM_CONSUMERD_EXIT_FAILURE, /* Consumerd exiting on error */
+ LTTCOMM_CONSUMERD_OUTFD_ERROR, /* Error opening the tracefile */
+ LTTCOMM_CONSUMERD_SPLICE_EBADF, /* EBADF from splice(2) */
+ LTTCOMM_CONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */
+ LTTCOMM_CONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */
+ LTTCOMM_CONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */
+ LTTCOMM_CONSUMERD_ENOMEM, /* Consumer is out of memory */
+ LTTCOMM_CONSUMERD_ERROR_METADATA, /* Error with metadata. */
+ LTTCOMM_CONSUMERD_FATAL, /* Fatal error. */
+ LTTCOMM_CONSUMERD_RELAYD_FAIL, /* Error on remote relayd */
+ LTTCOMM_CONSUMERD_CHANNEL_FAIL, /* Channel creation failed. */
+ LTTCOMM_CONSUMERD_CHAN_NOT_FOUND, /* Channel not found. */
+ LTTCOMM_CONSUMERD_ALREADY_SET, /* Resource already set. */
+ LTTCOMM_CONSUMERD_ROTATION_FAIL, /* Rotation has failed. */
+ LTTCOMM_CONSUMERD_SNAPSHOT_FAILED, /* snapshot has failed. */
+ LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED, /* Trace chunk creation failed. */
LTTCOMM_CONSUMERD_CLOSE_TRACE_CHUNK_FAILED, /* Trace chunk close failed. */
- LTTCOMM_CONSUMERD_INVALID_PARAMETERS, /* Invalid parameters. */
+ LTTCOMM_CONSUMERD_INVALID_PARAMETERS, /* Invalid parameters. */
LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_LOCAL, /* Trace chunk exists on consumer daemon. */
- LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE,/* Trace chunk exists on relay daemon. */
- LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK, /* Unknown trace chunk. */
- LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED, /* Relayd does not accept clear command. */
- LTTCOMM_CONSUMERD_UNKNOWN_ERROR, /* Unknown error. */
+ LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE, /* Trace chunk exists on relay daemon. */
+ LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK, /* Unknown trace chunk. */
+ LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED, /* Relayd does not accept clear command. */
+ LTTCOMM_CONSUMERD_UNKNOWN_ERROR, /* Unknown error. */
/* MUST be last element */
- LTTCOMM_NR, /* Last element */
+ LTTCOMM_NR, /* Last element */
};
/* lttng socket protocol. */
* Index in the net_families array below. Please keep in sync!
*/
enum lttcomm_sock_domain {
- LTTCOMM_INET = 0,
- LTTCOMM_INET6 = 1,
+ LTTCOMM_INET = 0,
+ LTTCOMM_INET6 = 1,
};
enum lttcomm_metadata_command {
struct lttcomm_net_family {
int family;
- int (*create) (struct lttcomm_sock *sock, int type, int proto);
+ int (*create)(struct lttcomm_sock *sock, int type, int proto);
};
struct lttcomm_proto_ops {
- int (*bind) (struct lttcomm_sock *sock);
- int (*close) (struct lttcomm_sock *sock);
- int (*connect) (struct lttcomm_sock *sock);
- struct lttcomm_sock *(*accept) (struct lttcomm_sock *sock);
- int (*listen) (struct lttcomm_sock *sock, int backlog);
- ssize_t (*recvmsg) (struct lttcomm_sock *sock, void *buf, size_t len,
- int flags);
- ssize_t (*sendmsg) (struct lttcomm_sock *sock, const void *buf,
- size_t len, int flags);
+ int (*bind)(struct lttcomm_sock *sock);
+ int (*close)(struct lttcomm_sock *sock);
+ int (*connect)(struct lttcomm_sock *sock);
+ struct lttcomm_sock *(*accept)(struct lttcomm_sock *sock);
+ int (*listen)(struct lttcomm_sock *sock, int backlog);
+ ssize_t (*recvmsg)(struct lttcomm_sock *sock, void *buf, size_t len, int flags);
+ ssize_t (*sendmsg)(struct lttcomm_sock *sock, const void *buf, size_t len, int flags);
};
struct process_attr_integral_value_comm {
* Data structure received from lttng client to session daemon.
*/
struct lttcomm_session_msg {
- uint32_t cmd_type; /* enum lttcomm_sessiond_command */
+ uint32_t cmd_type; /* enum lttcomm_sessiond_command */
struct lttng_session session;
struct lttng_domain domain;
union {
} LTTNG_PACKED snapshot_record;
struct {
uint32_t nb_uri;
- unsigned int timer_interval; /* usec */
+ unsigned int timer_interval; /* usec */
} LTTNG_PACKED session_live;
struct {
struct lttng_save_session_attr attr;
uint32_t fd_count;
} LTTNG_PACKED;
-#define LTTNG_FILTER_MAX_LEN 65536
-#define LTTNG_SESSION_DESCRIPTOR_MAX_LEN 65536
+#define LTTNG_FILTER_MAX_LEN 65536
+#define LTTNG_SESSION_DESCRIPTOR_MAX_LEN 65536
/*
* Filter bytecode data. The reloc table is located at the end of the
* bytecode. It is made of tuples: (uint16_t, var. len. string). It
* starts at reloc_table_offset.
*/
-#define LTTNG_FILTER_PADDING 32
+#define LTTNG_FILTER_PADDING 32
struct lttng_bytecode {
- uint32_t len; /* len of data */
+ uint32_t len; /* len of data */
uint32_t reloc_table_offset;
uint64_t seqnum;
char padding[LTTNG_FILTER_PADDING];
* by zero or more names, where the actual number of names is given by
* the 'count' item of the structure.
*/
-#define LTTNG_EVENT_EXCLUSION_PADDING 32
+#define LTTNG_EVENT_EXCLUSION_PADDING 32
struct lttng_event_exclusion {
uint32_t count;
char padding[LTTNG_EVENT_EXCLUSION_PADDING];
char names[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH][LTTNG_SYMBOL_NAME_LEN];
} LTTNG_PACKED;
-#define LTTNG_EVENT_EXCLUSION_NAME_AT(_exclusion, _i) \
- ((_exclusion)->names[_i])
+#define LTTNG_EVENT_EXCLUSION_NAME_AT(_exclusion, _i) ((_exclusion)->names[_i])
/*
* Listing command header.
* Data structure for the response from sessiond to the lttng client.
*/
struct lttcomm_lttng_msg {
- uint32_t cmd_type; /* enum lttcomm_sessiond_command */
- uint32_t ret_code; /* enum lttcomm_return_code */
- uint32_t pid; /* pid_t */
+ uint32_t cmd_type; /* enum lttcomm_sessiond_command */
+ uint32_t ret_code; /* enum lttcomm_return_code */
+ uint32_t pid; /* pid_t */
uint32_t cmd_header_size;
uint32_t data_size;
uint32_t fd_count;
* operation.
*/
struct lttcomm_consumer_msg {
- uint32_t cmd_type; /* enum lttng_consumer_command */
+ uint32_t cmd_type; /* enum lttng_consumer_command */
union {
struct {
uint64_t channel_key;
struct {
uint64_t stream_key;
uint64_t channel_key;
- int32_t cpu; /* On which CPU this stream is assigned. */
+ int32_t cpu; /* On which CPU this stream is assigned. */
/* Tells the consumer if the stream should be or not monitored. */
uint32_t no_monitor;
- } LTTNG_PACKED stream; /* Only used by Kernel. */
+ } LTTNG_PACKED stream; /* Only used by Kernel. */
struct {
uint64_t net_index;
enum lttng_stream_type type;
uint64_t session_id;
} LTTNG_PACKED data_pending;
struct {
- uint64_t subbuf_size; /* bytes */
- uint64_t num_subbuf; /* power of 2 */
- int32_t overwrite; /* 1: overwrite, 0: discard */
- uint32_t switch_timer_interval; /* usec */
- uint32_t read_timer_interval; /* usec */
- unsigned int live_timer_interval; /* usec */
- uint8_t is_live; /* is part of a live session */
- uint32_t monitor_timer_interval; /* usec */
- int32_t output; /* splice, mmap */
- int32_t type; /* metadata or per_cpu */
- uint64_t session_id; /* Tracing session id */
- char pathname[PATH_MAX]; /* Channel file path. */
- char name[LTTNG_SYMBOL_NAME_LEN]; /* Channel name. */
+ uint64_t subbuf_size; /* bytes */
+ uint64_t num_subbuf; /* power of 2 */
+ int32_t overwrite; /* 1: overwrite, 0: discard */
+ uint32_t switch_timer_interval; /* usec */
+ uint32_t read_timer_interval; /* usec */
+ unsigned int live_timer_interval; /* usec */
+ uint8_t is_live; /* is part of a live session */
+ uint32_t monitor_timer_interval; /* usec */
+ int32_t output; /* splice, mmap */
+ int32_t type; /* metadata or per_cpu */
+ uint64_t session_id; /* Tracing session id */
+ char pathname[PATH_MAX]; /* Channel file path. */
+ char name[LTTNG_SYMBOL_NAME_LEN]; /* Channel name. */
/* Credentials used to open the UST buffer shared mappings. */
struct {
uint32_t uid;
uint32_t gid;
} LTTNG_PACKED buffer_credentials;
- uint64_t relayd_id; /* Relayd id if apply. */
- uint64_t key; /* Unique channel key. */
+ uint64_t relayd_id; /* Relayd id if apply. */
+ uint64_t key; /* Unique channel key. */
/* ID of the session's current trace chunk. */
LTTNG_OPTIONAL_COMM(uint64_t) LTTNG_PACKED chunk_id;
- unsigned char uuid[LTTNG_UUID_LEN]; /* uuid for ust tracer. */
- uint32_t chan_id; /* Channel ID on the tracer side. */
- uint64_t tracefile_size; /* bytes */
- uint32_t tracefile_count; /* number of tracefiles */
- uint64_t session_id_per_pid; /* Per-pid session ID. */
+ unsigned char uuid[LTTNG_UUID_LEN]; /* uuid for ust tracer. */
+ uint32_t chan_id; /* Channel ID on the tracer side. */
+ uint64_t tracefile_size; /* bytes */
+ uint32_t tracefile_count; /* number of tracefiles */
+ uint64_t session_id_per_pid; /* Per-pid session ID. */
/* Tells the consumer if the stream should be or not monitored. */
uint32_t monitor;
/*
uint64_t key;
} LTTNG_PACKED destroy_channel;
struct {
- uint64_t key; /* Metadata channel key. */
- uint64_t target_offset; /* Offset in the consumer */
- uint64_t len; /* Length of metadata to be received. */
+ uint64_t key; /* Metadata channel key. */
+ uint64_t target_offset; /* Offset in the consumer */
+ uint64_t len; /* Length of metadata to be received. */
uint64_t version; /* Version of the metadata. */
} LTTNG_PACKED push_metadata;
struct {
- uint64_t key; /* Metadata channel key. */
+ uint64_t key; /* Metadata channel key. */
} LTTNG_PACKED close_metadata;
struct {
- uint64_t key; /* Metadata channel key. */
+ uint64_t key; /* Metadata channel key. */
} LTTNG_PACKED setup_metadata;
struct {
- uint64_t key; /* Channel key. */
+ uint64_t key; /* Channel key. */
} LTTNG_PACKED flush_channel;
struct {
- uint64_t key; /* Channel key. */
+ uint64_t key; /* Channel key. */
} LTTNG_PACKED clear_quiescent_channel;
struct {
char pathname[PATH_MAX];
/* Indicate if the snapshot goes on the relayd or locally. */
uint32_t use_relayd;
- uint32_t metadata; /* This a metadata snapshot. */
- uint64_t relayd_id; /* Relayd id if apply. */
+ uint32_t metadata; /* This a metadata snapshot. */
+ uint64_t relayd_id; /* Relayd id if apply. */
uint64_t key;
uint64_t nb_packets_per_stream;
} LTTNG_PACKED snapshot_channel;
LTTNG_OPTIONAL_COMM(struct {
uint32_t uid;
uint32_t gid;
- } LTTNG_PACKED ) LTTNG_PACKED credentials;
+ } LTTNG_PACKED)
+ LTTNG_PACKED credentials;
} LTTNG_PACKED create_trace_chunk;
struct {
LTTNG_OPTIONAL_COMM(uint64_t) LTTNG_PACKED relayd_id;
struct lttcomm_ust_reply {
uint32_t handle;
uint32_t cmd;
- uint32_t ret_code; /* enum lttcomm_return_code */
- uint32_t ret_val; /* return value */
+ uint32_t ret_code; /* enum lttcomm_return_code */
+ uint32_t ret_val; /* return value */
union {
struct {
uint64_t memory_map_size;
const char *lttcomm_get_readable_code(enum lttcomm_return_code code);
int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr *sockaddr,
- const char *ip, unsigned int port);
+ const char *ip,
+ unsigned int port);
int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr *sockaddr,
- const char *ip, unsigned int port);
+ const char *ip,
+ unsigned int port);
struct lttcomm_sock *lttcomm_alloc_sock(enum lttcomm_sock_proto proto);
int lttcomm_populate_sock_from_open_socket(struct lttcomm_sock *sock,
- int fd,
- enum lttcomm_sock_proto protocol);
+ int fd,
+ enum lttcomm_sock_proto protocol);
int lttcomm_create_sock(struct lttcomm_sock *sock);
struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri);
void lttcomm_destroy_sock(struct lttcomm_sock *sock);
struct lttcomm_sock *lttcomm_alloc_copy_sock(struct lttcomm_sock *src);
-void lttcomm_copy_sock(struct lttcomm_sock *dst,
- struct lttcomm_sock *src);
+void lttcomm_copy_sock(struct lttcomm_sock *dst, struct lttcomm_sock *src);
/* Relayd socket object. */
-struct lttcomm_relayd_sock *lttcomm_alloc_relayd_sock(
- struct lttng_uri *uri, uint32_t major, uint32_t minor);
+struct lttcomm_relayd_sock *
+lttcomm_alloc_relayd_sock(struct lttng_uri *uri, uint32_t major, uint32_t minor);
int lttcomm_setsockopt_rcv_timeout(int sock, unsigned int msec);
int lttcomm_setsockopt_snd_timeout(int sock, unsigned int msec);
-int lttcomm_sock_get_port(const struct lttcomm_sock *sock,
- uint16_t *port);
+int lttcomm_sock_get_port(const struct lttcomm_sock *sock, uint16_t *port);
/*
* Set a port to an lttcomm_sock. This will have no effect is the socket is
* already bound.
/* Get network timeout, in milliseconds */
unsigned long lttcomm_get_network_timeout();
-#endif /* _LTTNG_SESSIOND_COMM_H */
+#endif /* _LTTNG_SESSIOND_COMM_H */
bool lttng_snapshot_output_validate(const struct lttng_snapshot_output *output);
-bool lttng_snapshot_output_is_equal(
- const struct lttng_snapshot_output *a,
- const struct lttng_snapshot_output *b);
+bool lttng_snapshot_output_is_equal(const struct lttng_snapshot_output *a,
+ const struct lttng_snapshot_output *b);
-int lttng_snapshot_output_serialize(
- const struct lttng_snapshot_output *output,
- struct lttng_payload *payload);
+int lttng_snapshot_output_serialize(const struct lttng_snapshot_output *output,
+ struct lttng_payload *payload);
-ssize_t lttng_snapshot_output_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_snapshot_output **output_p);
+ssize_t lttng_snapshot_output_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_snapshot_output **output_p);
-enum lttng_error_code lttng_snapshot_output_mi_serialize(
- const struct lttng_snapshot_output *output,
- struct mi_writer *writer);
+enum lttng_error_code lttng_snapshot_output_mi_serialize(const struct lttng_snapshot_output *output,
+ struct mi_writer *writer);
#endif /* COMMON_SNAPSHOT_H */
*/
#include <lttng/lttng-export.h>
+
#include <stdbool.h>
/*
* This symbol was mistakenly made public before the 2.12 release. It can't
* be removed (but it can be stubbed-out if necessary).
*/
-extern "C" LTTNG_EXPORT
-int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode);
+extern "C" LTTNG_EXPORT int
+spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode);
#endif /* ifndef LTTNG_SPAWN_VIEWER_H */
* assumes that no grouping/locale-aware formatting is performed (i.e. using
* the `'` specifier in POSIX formatting functions).
*/
-#define MAX_INT_DEC_LEN(val) ((3 * sizeof(val)) + 2)
+#define MAX_INT_DEC_LEN(val) ((3 * sizeof(val)) + 2)
#endif /* _STRING_UTILS_FORMAT_H */
#ifndef _STRING_UTILS_H
#define _STRING_UTILS_H
-#include <stdbool.h>
-#include <common/macros.hpp>
#include <common/dynamic-array.hpp>
+#include <common/macros.hpp>
+
+#include <stdbool.h>
void strutils_normalize_star_glob_pattern(char *pattern);
char *strutils_unescape_string(const char *input, char only_char);
-int strutils_split(const char *input, char delim, bool escape_delim,
- struct lttng_dynamic_pointer_array *out_strings);
+int strutils_split(const char *input,
+ char delim,
+ bool escape_delim,
+ struct lttng_dynamic_pointer_array *out_strings);
void strutils_free_null_terminated_array_of_strings(char **array);
-size_t strutils_array_of_strings_len(char * const *array);
+size_t strutils_array_of_strings_len(char *const *array);
/*
* Append `append` to the malloc-end string `str`.
* Like `strutils_append_str`, but the appended string is formatted using
* `fmt` and the following arguments.
*/
-C_LINKAGE ATTR_FORMAT_PRINTF(2, 3)
-int strutils_appendf(char **s, const char *fmt, ...);
+C_LINKAGE ATTR_FORMAT_PRINTF(2, 3) int strutils_appendf(char **s, const char *fmt, ...);
#endif /* _STRING_UTILS_H */
* set.
* Return a non-zero error code to indicate failure.
*/
-#define testpoint(name) \
- ((caa_unlikely(lttng_testpoint_activated)) \
- ? __testpoint_##name##_wrapper() : 0)
+#define testpoint(name) \
+ ((caa_unlikely(lttng_testpoint_activated)) ? __testpoint_##name##_wrapper() : 0)
/*
* One wrapper per testpoint is generated. This is to keep track of the symbol
* lookup status and the corresponding function pointer, if any.
*/
-#define _TESTPOINT_DECL(_name) \
- static inline int __testpoint_##_name##_wrapper(void) \
- { \
- int ret = 0; \
- static int (*tp)(void); \
- static int found; \
- const char *tp_name = "__testpoint_" #_name; \
- \
- if (tp) { \
- ret = tp(); \
- } else { \
- if (!found) { \
- tp = (int (*)(void)) lttng_testpoint_lookup(tp_name); \
- if (tp) { \
- found = 1; \
- ret = tp(); \
- } else { \
- found = -1; \
- } \
- } \
- } \
- return ret; \
+#define _TESTPOINT_DECL(_name) \
+ static inline int __testpoint_##_name##_wrapper(void) \
+ { \
+ int ret = 0; \
+ static int (*tp)(void); \
+ static int found; \
+ const char *tp_name = "__testpoint_" #_name; \
+ \
+ if (tp) { \
+ ret = tp(); \
+ } else { \
+ if (!found) { \
+ tp = (int (*)(void)) lttng_testpoint_lookup(tp_name); \
+ if (tp) { \
+ found = 1; \
+ ret = tp(); \
+ } else { \
+ found = -1; \
+ } \
+ } \
+ } \
+ return ret; \
}
/* Testpoint declaration */
-#define TESTPOINT_DECL(name) \
- _TESTPOINT_DECL(name)
+#define TESTPOINT_DECL(name) _TESTPOINT_DECL(name)
#endif /* NTESTPOINT */
#ifndef LTTNG_TIME_H
#define LTTNG_TIME_H
-#include <time.h>
+#include <common/compat/time.hpp>
+#include <common/macros.hpp>
+
#include <ctime>
#include <stdbool.h>
#include <string>
+#include <time.h>
-#include <common/macros.hpp>
-#include <common/compat/time.hpp>
-
-#define MSEC_PER_SEC 1000ULL
-#define NSEC_PER_SEC 1000000000ULL
-#define NSEC_PER_MSEC 1000000ULL
-#define NSEC_PER_USEC 1000ULL
-#define USEC_PER_SEC 1000000ULL
-#define USEC_PER_MSEC 1000ULL
+#define MSEC_PER_SEC 1000ULL
+#define NSEC_PER_SEC 1000000000ULL
+#define NSEC_PER_MSEC 1000000ULL
+#define NSEC_PER_USEC 1000ULL
+#define USEC_PER_SEC 1000000ULL
+#define USEC_PER_MSEC 1000ULL
-#define SEC_PER_MINUTE 60ULL
+#define SEC_PER_MINUTE 60ULL
#define MINUTE_PER_HOUR 60ULL
#define USEC_PER_MINUTE (USEC_PER_SEC * SEC_PER_MINUTE)
-#define USEC_PER_HOURS (USEC_PER_MINUTE * MINUTE_PER_HOUR)
+#define USEC_PER_HOURS (USEC_PER_MINUTE * MINUTE_PER_HOUR)
-#define ISO8601_STR_LEN sizeof("YYYYmmddTHHMMSS+HHMM")
+#define ISO8601_STR_LEN sizeof("YYYYmmddTHHMMSS+HHMM")
#define DATETIME_STR_LEN sizeof("YYYYmmdd-HHMMSS")
bool locale_supports_utf8();
-#define NSEC_UNIT "ns"
-#define USEC_UNIT (locale_supports_utf8() ? "µs" : "us")
-#define MSEC_UNIT "ms"
-#define SEC_UNIT "s"
-#define MIN_UNIT "m"
-#define HR_UNIT "h"
+#define NSEC_UNIT "ns"
+#define USEC_UNIT (locale_supports_utf8() ? "µs" : "us")
+#define MSEC_UNIT "ms"
+#define SEC_UNIT "s"
+#define MIN_UNIT "m"
+#define HR_UNIT "h"
/*
* timespec_to_ms: Convert timespec to milliseconds.
#ifndef LTTNG_TRACE_CHUNK_REGISTRY_H
#define LTTNG_TRACE_CHUNK_REGISTRY_H
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
#include <common/macros.hpp>
#include <common/trace-chunk.hpp>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
struct lttng_trace_chunk_registry;
/*
* (i.e. all references to the trace chunks it contains must be released) before
* it is destroyed.
*/
-void lttng_trace_chunk_registry_destroy(
- struct lttng_trace_chunk_registry *registry);
+void lttng_trace_chunk_registry_destroy(struct lttng_trace_chunk_registry *registry);
/*
* Publish a trace chunk for a given session id.
*
* Returns an lttng_trace_chunk on success, NULL on error.
*/
-struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk(
- struct lttng_trace_chunk_registry *registry,
- uint64_t session_id, struct lttng_trace_chunk *chunk);
+struct lttng_trace_chunk *
+lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *registry,
+ uint64_t session_id,
+ struct lttng_trace_chunk *chunk);
/*
* Adds the `previously_published` parameter which allows the caller
* to know if a trace chunk equivalent to `chunk` was previously published.
- *
+ *
* The registry holds a reference to the published trace chunks it contains.
* Trace chunks automatically unpublish themselves from their registry on
* destruction.
* This information is necessary to drop the reference of newly published
* chunks when a user doesn't wish to explicitly maintain all references
* to a given trace chunk.
- *
+ *
* For instance, the relay daemon doesn't need the registry to hold a
* reference since it controls the lifetime of its trace chunks.
* Conversely, the consumer daemons rely on the session daemon to inform
* belong to a specific top-level object: they are always retrieved from
* the registry by `id`.
*/
-struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk(
- struct lttng_trace_chunk_registry *registry,
- uint64_t session_id, struct lttng_trace_chunk *chunk,
- bool *previously_published);
+struct lttng_trace_chunk *
+lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *registry,
+ uint64_t session_id,
+ struct lttng_trace_chunk *chunk,
+ bool *previously_published);
/*
* Look-up a trace chunk by session_id and chunk_id.
*
* Returns an lttng_trace_chunk on success, NULL if the chunk does not exist.
*/
-struct lttng_trace_chunk *
-lttng_trace_chunk_registry_find_chunk(
- const struct lttng_trace_chunk_registry *registry,
- uint64_t session_id, uint64_t chunk_id);
+struct lttng_trace_chunk *lttng_trace_chunk_registry_find_chunk(
+ const struct lttng_trace_chunk_registry *registry, uint64_t session_id, uint64_t chunk_id);
/*
* Query the existence of a trace chunk by session_id and chunk_id.
*
* Returns 0 on success, a negative value on error.
*/
-int lttng_trace_chunk_registry_chunk_exists(
- const struct lttng_trace_chunk_registry *registry,
- uint64_t session_id, uint64_t chunk_id, bool *chunk_exists);
+int lttng_trace_chunk_registry_chunk_exists(const struct lttng_trace_chunk_registry *registry,
+ uint64_t session_id,
+ uint64_t chunk_id,
+ bool *chunk_exists);
/*
* Look-up an anonymous trace chunk by session_id.
* Returns an lttng_trace_chunk on success, NULL if the chunk does not exist.
*/
struct lttng_trace_chunk *
-lttng_trace_chunk_registry_find_anonymous_chunk(
- const struct lttng_trace_chunk_registry *registry,
- uint64_t session_id);
+lttng_trace_chunk_registry_find_anonymous_chunk(const struct lttng_trace_chunk_registry *registry,
+ uint64_t session_id);
-unsigned int lttng_trace_chunk_registry_put_each_chunk(
- const struct lttng_trace_chunk_registry *registry);
+unsigned int
+lttng_trace_chunk_registry_put_each_chunk(const struct lttng_trace_chunk_registry *registry);
#endif /* LTTNG_TRACE_CHUNK_REGISTRY_H */
#include <common/credentials.hpp>
#include <common/fd-tracker/fd-tracker.hpp>
#include <common/macros.hpp>
+
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous();
-struct lttng_trace_chunk *lttng_trace_chunk_create(
- uint64_t chunk_id,
- time_t chunk_creation_time,
- const char *path);
+struct lttng_trace_chunk *
+lttng_trace_chunk_create(uint64_t chunk_id, time_t chunk_creation_time, const char *path);
void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk,
- struct fd_tracker *fd_tracker);
+ struct fd_tracker *fd_tracker);
/*
* Copy a trace chunk. The copy that is returned is always a _user_
* mode chunk even if the source chunk was an _owner_ as there can never be
* two _owners_ of the same trace output.
*/
-struct lttng_trace_chunk *lttng_trace_chunk_copy(
- struct lttng_trace_chunk *source_chunk);
+struct lttng_trace_chunk *lttng_trace_chunk_copy(struct lttng_trace_chunk *source_chunk);
-enum lttng_trace_chunk_status lttng_trace_chunk_get_id(
- struct lttng_trace_chunk *chunk, uint64_t *id);
+enum lttng_trace_chunk_status lttng_trace_chunk_get_id(struct lttng_trace_chunk *chunk,
+ uint64_t *id);
-enum lttng_trace_chunk_status lttng_trace_chunk_get_creation_timestamp(
- struct lttng_trace_chunk *chunk, time_t *creation_ts);
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_creation_timestamp(struct lttng_trace_chunk *chunk, time_t *creation_ts);
-enum lttng_trace_chunk_status lttng_trace_chunk_get_close_timestamp(
- struct lttng_trace_chunk *chunk, time_t *close_ts);
+enum lttng_trace_chunk_status lttng_trace_chunk_get_close_timestamp(struct lttng_trace_chunk *chunk,
+ time_t *close_ts);
-enum lttng_trace_chunk_status lttng_trace_chunk_set_close_timestamp(
- struct lttng_trace_chunk *chunk, time_t close_ts);
+enum lttng_trace_chunk_status lttng_trace_chunk_set_close_timestamp(struct lttng_trace_chunk *chunk,
+ time_t close_ts);
-enum lttng_trace_chunk_status lttng_trace_chunk_get_name(
- struct lttng_trace_chunk *chunk, const char **name,
- bool *name_overridden);
+enum lttng_trace_chunk_status lttng_trace_chunk_get_name(struct lttng_trace_chunk *chunk,
+ const char **name,
+ bool *name_overridden);
bool lttng_trace_chunk_get_name_overridden(struct lttng_trace_chunk *chunk);
-enum lttng_trace_chunk_status lttng_trace_chunk_override_name(
- struct lttng_trace_chunk *chunk, const char *name);
+enum lttng_trace_chunk_status lttng_trace_chunk_override_name(struct lttng_trace_chunk *chunk,
+ const char *name);
+
+enum lttng_trace_chunk_status lttng_trace_chunk_rename_path(struct lttng_trace_chunk *chunk,
+ const char *path);
+
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_credentials(struct lttng_trace_chunk *chunk,
+ struct lttng_credentials *credentials);
+
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_credentials(struct lttng_trace_chunk *chunk,
+ const struct lttng_credentials *credentials);
+
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_credentials_current_user(struct lttng_trace_chunk *chunk);
+
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_as_owner(struct lttng_trace_chunk *chunk,
+ struct lttng_directory_handle *session_output_directory);
-enum lttng_trace_chunk_status lttng_trace_chunk_rename_path(
- struct lttng_trace_chunk *chunk, const char *path);
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_as_user(struct lttng_trace_chunk *chunk,
+ struct lttng_directory_handle *chunk_directory);
-enum lttng_trace_chunk_status lttng_trace_chunk_get_credentials(
- struct lttng_trace_chunk *chunk,
- struct lttng_credentials *credentials);
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_session_output_directory_handle(struct lttng_trace_chunk *chunk,
+ struct lttng_directory_handle **handle);
-enum lttng_trace_chunk_status lttng_trace_chunk_set_credentials(
- struct lttng_trace_chunk *chunk,
- const struct lttng_credentials *credentials);
+enum lttng_trace_chunk_status
+lttng_trace_chunk_borrow_chunk_directory_handle(struct lttng_trace_chunk *chunk,
+ const struct lttng_directory_handle **handle);
-enum lttng_trace_chunk_status lttng_trace_chunk_set_credentials_current_user(
- struct lttng_trace_chunk *chunk);
+enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(struct lttng_trace_chunk *chunk,
+ const char *subdirectory_path);
-enum lttng_trace_chunk_status lttng_trace_chunk_set_as_owner(
- struct lttng_trace_chunk *chunk,
- struct lttng_directory_handle *session_output_directory);
+enum lttng_trace_chunk_status lttng_trace_chunk_open_file(struct lttng_trace_chunk *chunk,
+ const char *filename,
+ int flags,
+ mode_t mode,
+ int *out_fd,
+ bool expect_no_file);
-enum lttng_trace_chunk_status lttng_trace_chunk_set_as_user(
- struct lttng_trace_chunk *chunk,
- struct lttng_directory_handle *chunk_directory);
+enum lttng_trace_chunk_status lttng_trace_chunk_open_fs_handle(struct lttng_trace_chunk *chunk,
+ const char *filename,
+ int flags,
+ mode_t mode,
+ struct fs_handle **out_handle,
+ bool expect_no_file);
+
+int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk, const char *filename);
+
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_close_command(struct lttng_trace_chunk *chunk,
+ enum lttng_trace_chunk_command_type *command_type);
enum lttng_trace_chunk_status
-lttng_trace_chunk_get_session_output_directory_handle(
- struct lttng_trace_chunk *chunk,
- struct lttng_directory_handle **handle);
-
-enum lttng_trace_chunk_status lttng_trace_chunk_borrow_chunk_directory_handle(
- struct lttng_trace_chunk *chunk,
- const struct lttng_directory_handle **handle);
-
-enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(
- struct lttng_trace_chunk *chunk,
- const char *subdirectory_path);
-
-enum lttng_trace_chunk_status lttng_trace_chunk_open_file(
- struct lttng_trace_chunk *chunk,
- const char *filename,
- int flags,
- mode_t mode,
- int *out_fd,
- bool expect_no_file);
-
-enum lttng_trace_chunk_status lttng_trace_chunk_open_fs_handle(
- struct lttng_trace_chunk *chunk,
- const char *filename,
- int flags,
- mode_t mode,
- struct fs_handle **out_handle,
- bool expect_no_file);
-
-int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk,
- const char *filename);
-
-enum lttng_trace_chunk_status lttng_trace_chunk_get_close_command(
- struct lttng_trace_chunk *chunk,
- enum lttng_trace_chunk_command_type *command_type);
-
-enum lttng_trace_chunk_status lttng_trace_chunk_set_close_command(
- struct lttng_trace_chunk *chunk,
- enum lttng_trace_chunk_command_type command_type);
-
-const char *lttng_trace_chunk_command_type_get_name(
- enum lttng_trace_chunk_command_type command);
+lttng_trace_chunk_set_close_command(struct lttng_trace_chunk *chunk,
+ enum lttng_trace_chunk_command_type command_type);
+
+const char *lttng_trace_chunk_command_type_get_name(enum lttng_trace_chunk_command_type command);
bool lttng_trace_chunk_ids_equal(const struct lttng_trace_chunk *chunk_a,
- const struct lttng_trace_chunk *chunk_b);
+ const struct lttng_trace_chunk *chunk_b);
/* Returns true on success. */
bool lttng_trace_chunk_get(struct lttng_trace_chunk *chunk);
#ifndef LTTNG_COMMON_TRACKER_H
#define LTTNG_COMMON_TRACKER_H
-#include <lttng/lttng-error.h>
-#include <lttng/tracker.h>
-
#include <common/buffer-view.hpp>
#include <common/dynamic-array.hpp>
#include <common/macros.hpp>
#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <lttng/lttng-error.h>
+#include <lttng/tracker.h>
+
struct process_attr_value {
enum lttng_process_attr_value_type type;
union value {
struct lttng_process_attr_values *lttng_process_attr_values_create();
/* Prefixed with '_' since the name conflicts with a public API. */
-unsigned int _lttng_process_attr_values_get_count(
- const struct lttng_process_attr_values *values);
+unsigned int _lttng_process_attr_values_get_count(const struct lttng_process_attr_values *values);
-const struct process_attr_value *lttng_process_attr_tracker_values_get_at_index(
- const struct lttng_process_attr_values *values,
- unsigned int index);
+const struct process_attr_value *
+lttng_process_attr_tracker_values_get_at_index(const struct lttng_process_attr_values *values,
+ unsigned int index);
-int lttng_process_attr_values_serialize(
- const struct lttng_process_attr_values *values,
- struct lttng_dynamic_buffer *buffer);
+int lttng_process_attr_values_serialize(const struct lttng_process_attr_values *values,
+ struct lttng_dynamic_buffer *buffer);
-ssize_t lttng_process_attr_values_create_from_buffer(
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- const struct lttng_buffer_view *buffer_view,
- struct lttng_process_attr_values **_values);
+ssize_t lttng_process_attr_values_create_from_buffer(enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ const struct lttng_buffer_view *buffer_view,
+ struct lttng_process_attr_values **_values);
-void lttng_process_attr_values_destroy(
- struct lttng_process_attr_values *values);
+void lttng_process_attr_values_destroy(struct lttng_process_attr_values *values);
-struct process_attr_value *process_attr_value_copy(
- const struct process_attr_value *value);
+struct process_attr_value *process_attr_value_copy(const struct process_attr_value *value);
unsigned long process_attr_value_hash(const struct process_attr_value *a);
bool process_attr_tracker_value_equal(const struct process_attr_value *a,
- const struct process_attr_value *b);
+ const struct process_attr_value *b);
void process_attr_value_destroy(struct process_attr_value *value);
-enum lttng_error_code process_attr_value_from_comm(
- enum lttng_domain_type domain,
- enum lttng_process_attr process_attr,
- enum lttng_process_attr_value_type value_type,
- const struct process_attr_integral_value_comm *integral_value,
- const struct lttng_buffer_view *value_view,
- struct process_attr_value **value);
+enum lttng_error_code
+process_attr_value_from_comm(enum lttng_domain_type domain,
+ enum lttng_process_attr process_attr,
+ enum lttng_process_attr_value_type value_type,
+ const struct process_attr_integral_value_comm *integral_value,
+ const struct lttng_buffer_view *value_view,
+ struct process_attr_value **value);
#endif /* LTTNG_COMMON_TRACKER_H */
#ifndef _LTTCOMM_UNIX_H
#define _LTTCOMM_UNIX_H
-#include <limits.h>
-#include <sys/un.h>
-
#include <common/compat/socket.hpp>
#include <common/macros.hpp>
-#include <common/payload.hpp>
#include <common/payload-view.hpp>
+#include <common/payload.hpp>
+
+#include <limits.h>
+#include <sys/un.h>
int lttcomm_create_unix_sock(const char *pathname);
int lttcomm_create_anon_unix_socketpair(int *fds);
/* Send a message accompanied by fd(s) over a unix socket. */
ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd);
-ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock,
- struct lttng_payload_view *view);
-ssize_t lttcomm_send_fds_unix_sock_non_block(
- int sock, const int *fds, size_t nb_fd);
+ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock, struct lttng_payload_view *view);
+ssize_t lttcomm_send_fds_unix_sock_non_block(int sock, const int *fds, size_t nb_fd);
ssize_t lttcomm_send_payload_view_fds_unix_sock_non_block(int sock,
- struct lttng_payload_view *view);
+ struct lttng_payload_view *view);
/* Recv a message accompanied by fd(s) from a unix socket */
ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd);
-ssize_t lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd,
- struct lttng_payload *payload);
+ssize_t lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd, struct lttng_payload *payload);
ssize_t lttcomm_recv_fds_unix_sock_non_block(int sock, int *fds, size_t nb_fd);
-ssize_t lttcomm_recv_payload_fds_unix_sock_non_block(int sock, size_t nb_fd,
- struct lttng_payload *payload);
+ssize_t
+lttcomm_recv_payload_fds_unix_sock_non_block(int sock, size_t nb_fd, struct lttng_payload *payload);
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len);
ssize_t lttcomm_recv_unix_sock_non_block(int sock, void *buf, size_t len);
ssize_t lttcomm_send_unix_sock_non_block(int sock, const void *buf, size_t len);
ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len);
-ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
- lttng_sock_cred *creds);
+ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, lttng_sock_cred *creds);
int lttcomm_setsockopt_creds_unix_sock(int sock);
-#endif /* _LTTCOMM_UNIX_H */
+#endif /* _LTTCOMM_UNIX_H */
#define LTTNG_URCU_H
#define _LGPL_SOURCE
-#include <urcu.h>
#include <mutex>
+#include <urcu.h>
namespace lttng {
namespace urcu {
#ifndef URI_H
#define URI_H
-#include <netinet/in.h>
-#include <lttng/lttng.h>
#include <common/macros.hpp>
+#include <lttng/lttng.h>
+
+#include <netinet/in.h>
+
/* Destination type of lttng URI */
enum lttng_dst_type {
- LTTNG_DST_IPV4 = 1,
- LTTNG_DST_IPV6 = 2,
- LTTNG_DST_PATH = 3,
+ LTTNG_DST_IPV4 = 1,
+ LTTNG_DST_IPV6 = 2,
+ LTTNG_DST_PATH = 3,
};
/* Type of lttng URI where it is a final destination or a hop */
enum lttng_uri_type {
- LTTNG_URI_DST, /* The URI is a final destination */
+ LTTNG_URI_DST, /* The URI is a final destination */
/*
* Hops are not supported yet but planned for a future release.
*
* should be ignored.
*/
enum lttng_proto_type {
- LTTNG_PROTO_TYPE_NONE = 0,
- LTTNG_TCP = 1,
+ LTTNG_PROTO_TYPE_NONE = 0,
+ LTTNG_TCP = 1,
/*
* UDP protocol is not supported for now.
*
int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2);
void uri_free(struct lttng_uri *uri);
ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris);
-ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
- struct lttng_uri **uris);
+ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lttng_uri **uris);
int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size);
#endif /* _LTT_URI_H */
#include <common/compat/errno.hpp>
#include <common/consumer/consumer.hpp>
+
#include <stdbool.h>
#ifdef HAVE_LIBLTTNG_UST_CTL
int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream);
-int lttng_ustconsumer_sample_snapshot_positions(
- struct lttng_consumer_stream *stream);
+int lttng_ustconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream);
-int lttng_ustconsumer_get_produced_snapshot(
- struct lttng_consumer_stream *stream, unsigned long *pos);
-int lttng_ustconsumer_get_consumed_snapshot(
- struct lttng_consumer_stream *stream, unsigned long *pos);
+int lttng_ustconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
+ unsigned long *pos);
+int lttng_ustconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
+ unsigned long *pos);
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
- int sock, struct pollfd *consumer_sockpoll);
+ int sock,
+ struct pollfd *consumer_sockpoll);
extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
- struct lttng_consumer_local_data *ctx);
+ struct lttng_consumer_local_data *ctx);
int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
-int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
- int producer_active);
-int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
- uint64_t *stream_id);
+int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, int producer_active);
+int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, uint64_t *stream_id);
int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht);
void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata);
void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream);
-int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
- uint64_t len, uint64_t version,
- struct lttng_consumer_channel *channel, int timer, int wait);
+int lttng_ustconsumer_recv_metadata(int sock,
+ uint64_t key,
+ uint64_t offset,
+ uint64_t len,
+ uint64_t version,
+ struct lttng_consumer_channel *channel,
+ int timer,
+ int wait);
int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
- struct lttng_consumer_channel *channel, int timer, int wait);
-enum sync_metadata_status lttng_ustconsumer_sync_metadata(
- struct lttng_consumer_local_data *ctx,
- struct lttng_consumer_stream *metadata);
-int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
- int producer);
+ struct lttng_consumer_channel *channel,
+ int timer,
+ int wait);
+enum sync_metadata_status lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
+ struct lttng_consumer_stream *metadata);
+int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, int producer);
int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream);
-int lttng_ustconsumer_get_current_timestamp(
- struct lttng_consumer_stream *stream, uint64_t *ts);
-int lttng_ustconsumer_get_sequence_number(
- struct lttng_consumer_stream *stream, uint64_t *seq);
+int lttng_ustconsumer_get_current_timestamp(struct lttng_consumer_stream *stream, uint64_t *ts);
+int lttng_ustconsumer_get_sequence_number(struct lttng_consumer_stream *stream, uint64_t *seq);
void lttng_ustconsumer_sigbus_handle(void *addr);
#else /* HAVE_LIBLTTNG_UST_CTL */
-static inline
-ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
- struct lttng_consumer_local_data *ctx __attribute__((unused)),
- struct lttng_consumer_stream *stream __attribute__((unused)),
- unsigned long len __attribute__((unused)),
- unsigned long padding __attribute__((unused)))
+static inline ssize_t lttng_ustconsumer_on_read_subbuffer_mmap(
+ struct lttng_consumer_local_data *ctx __attribute__((unused)),
+ struct lttng_consumer_stream *stream __attribute__((unused)),
+ unsigned long len __attribute__((unused)),
+ unsigned long padding __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
- struct lttng_consumer_local_data *ctx __attribute__((unused)),
- struct lttng_consumer_stream *uststream __attribute__((unused)),
- unsigned long len __attribute__((unused)),
- unsigned long padding __attribute__((unused)))
+static inline ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
+ struct lttng_consumer_local_data *ctx __attribute__((unused)),
+ struct lttng_consumer_stream *uststream __attribute__((unused)),
+ unsigned long len __attribute__((unused)),
+ unsigned long padding __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_take_snapshot(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_sample_snapshot_positions(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline int lttng_ustconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_get_produced_snapshot(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- unsigned long *pos __attribute__((unused)))
+static inline int lttng_ustconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ unsigned long *pos
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_get_consumed_snapshot(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- unsigned long *pos __attribute__((unused)))
+static inline int lttng_ustconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ unsigned long *pos
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_recv_cmd(
- struct lttng_consumer_local_data *ctx __attribute__((unused)),
- int sock __attribute__((unused)),
- struct pollfd *consumer_sockpoll __attribute__((unused)))
+static inline int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx
+ __attribute__((unused)),
+ int sock __attribute__((unused)),
+ struct pollfd *consumer_sockpoll
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-void lttng_ustconsumer_del_channel(
- struct lttng_consumer_channel *chan __attribute__((unused)))
+static inline void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan
+ __attribute__((unused)))
{
}
-static inline
-void lttng_ustconsumer_free_channel(
- struct lttng_consumer_channel *chan __attribute__((unused)))
+static inline void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan
+ __attribute__((unused)))
{
}
-static inline
-int lttng_ustconsumer_add_stream(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-void lttng_ustconsumer_del_stream(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
}
-static inline
-int lttng_ustconsumer_read_subbuffer(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- struct lttng_consumer_local_data *ctx __attribute__((unused)))
+static inline int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ struct lttng_consumer_local_data *ctx
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_on_recv_stream(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-void lttng_ustconsumer_on_stream_hangup(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
}
-static inline
-int lttng_ustconsumer_data_pending(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)),
- int producer_active __attribute__((unused)))
+static inline int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ int producer_active __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-void lttng_ustconsumer_close_all_metadata(
- struct lttng_ht *ht __attribute__((unused)))
+static inline void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht __attribute__((unused)))
{
}
-static inline
-void lttng_ustconsumer_close_metadata(
- struct lttng_consumer_channel *metadata __attribute__((unused)))
+static inline void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata
+ __attribute__((unused)))
{
}
-static inline
-void lttng_ustconsumer_close_stream_wakeup(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
}
-static inline
-int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)),
- uint64_t key __attribute__((unused)),
- uint64_t offset __attribute__((unused)),
- uint64_t len __attribute__((unused)),
- uint64_t version __attribute__((unused)),
- struct lttng_consumer_channel *channel __attribute__((unused)),
- int timer __attribute__((unused)))
+static inline int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)),
+ uint64_t key __attribute__((unused)),
+ uint64_t offset __attribute__((unused)),
+ uint64_t len __attribute__((unused)),
+ uint64_t version __attribute__((unused)),
+ struct lttng_consumer_channel *channel
+ __attribute__((unused)),
+ int timer __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_request_metadata(
- struct lttng_consumer_local_data *ctx __attribute__((unused)),
- struct lttng_consumer_channel *channel __attribute__((unused)),
- int timer __attribute__((unused)),
- int wait __attribute__((unused)))
+static inline int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx
+ __attribute__((unused)),
+ struct lttng_consumer_channel *channel
+ __attribute__((unused)),
+ int timer __attribute__((unused)),
+ int wait __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-enum sync_metadata_status lttng_ustconsumer_sync_metadata(
- struct lttng_consumer_local_data *ctx __attribute__((unused)),
- struct lttng_consumer_stream *metadata __attribute__((unused)))
+static inline enum sync_metadata_status
+lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx __attribute__((unused)),
+ struct lttng_consumer_stream *metadata __attribute__((unused)))
{
return SYNC_METADATA_STATUS_ERROR;
}
-static inline
-int lttng_ustconsumer_flush_buffer(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- int producer __attribute__((unused)))
+static inline int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ int producer __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_clear_buffer(
- struct lttng_consumer_stream *stream __attribute__((unused)))
+static inline int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream
+ __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_get_current_timestamp(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- uint64_t *ts __attribute__((unused)))
+static inline int lttng_ustconsumer_get_current_timestamp(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ uint64_t *ts __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_get_sequence_number(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- uint64_t *seq __attribute__((unused)))
+static inline int lttng_ustconsumer_get_sequence_number(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ uint64_t *seq __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-int lttng_ustconsumer_get_stream_id(
- struct lttng_consumer_stream *stream __attribute__((unused)),
- uint64_t *stream_id __attribute__((unused)))
+static inline int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream
+ __attribute__((unused)),
+ uint64_t *stream_id __attribute__((unused)))
{
return -ENOSYS;
}
-static inline
-void lttng_ustconsumer_sigbus_handle(
- void *addr __attribute__((unused)))
+static inline void lttng_ustconsumer_sigbus_handle(void *addr __attribute__((unused)))
{
}
#endif /* HAVE_LIBLTTNG_UST_CTL */
#ifndef _COMMON_UTILS_H
#define _COMMON_UTILS_H
-#include <getopt.h>
+#include <common/compat/directory-handle.hpp>
+
#include <lttng/lttng-error.h>
+
+#include <getopt.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
-#include <common/compat/directory-handle.hpp>
-
#define KIBI_LOG2 10
#define MEBI_LOG2 20
#define GIBI_LOG2 30
int utils_create_pid_file(pid_t pid, const char *filepath);
int utils_mkdir(const char *path, mode_t mode, int uid, int gid);
int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid);
-int utils_stream_file_path(const char *path_name, const char *file_name,
- uint64_t size, uint64_t count, const char *suffix,
- char *out_stream_path, size_t stream_path_len);
-int utils_parse_size_suffix(char const * const str, uint64_t * const size);
-int utils_parse_time_suffix(char const * const str, uint64_t * const time_us);
+int utils_stream_file_path(const char *path_name,
+ const char *file_name,
+ uint64_t size,
+ uint64_t count,
+ const char *suffix,
+ char *out_stream_path,
+ size_t stream_path_len);
+int utils_parse_size_suffix(char const *const str, uint64_t *const size);
+int utils_parse_time_suffix(char const *const str, uint64_t *const time_us);
int utils_get_count_order_u32(uint32_t x);
int utils_get_count_order_u64(uint64_t x);
const char *utils_get_home_dir();
ATTR_FORMAT_STRFTIME(1);
int utils_get_group_id(const char *name, bool warn, gid_t *gid);
-char *utils_generate_optstring(const struct option *long_options,
- size_t opt_count);
+char *utils_generate_optstring(const struct option *long_options, size_t opt_count);
int utils_create_lock_file(const char *filepath);
int utils_recursive_rmdir(const char *path);
int utils_truncate_stream_file(int fd, off_t length);
int utils_get_memory_available(uint64_t *value);
int utils_get_memory_total(uint64_t *value);
int utils_change_working_directory(const char *path);
-enum lttng_error_code utils_user_id_from_name(
- const char *user_name, uid_t *user_id);
-enum lttng_error_code utils_group_id_from_name(
- const char *group_name, gid_t *group_id);
+enum lttng_error_code utils_user_id_from_name(const char *user_name, uid_t *user_id);
+enum lttng_error_code utils_group_id_from_name(const char *group_name, gid_t *group_id);
/*
* Parse `str` as an unsigned long long value.
* - `str` is zero length
* - `str` contains invalid
*/
-int utils_parse_unsigned_long_long(const char *str,
- unsigned long long *value);
+int utils_parse_unsigned_long_long(const char *str, unsigned long long *value);
#endif /* _COMMON_UTILS_H */
#define LTTNG_UUID_H
#include <common/macros.hpp>
+
+#include <array>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
-#include <inttypes.h>
-#include <array>
#include <string>
/*
* Includes final \0.
*/
-#define LTTNG_UUID_STR_LEN 37
-#define LTTNG_UUID_LEN 16
-#define LTTNG_UUID_VER 4
+#define LTTNG_UUID_STR_LEN 37
+#define LTTNG_UUID_LEN 16
+#define LTTNG_UUID_VER 4
-#define LTTNG_UUID_FMT \
- "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 \
- "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 \
- "-%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 \
- "%02" SCNx8
+#define LTTNG_UUID_FMT \
+ "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 \
+ "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 \
+ "%02" SCNx8 "%02" SCNx8
-#define LTTNG_UUID_FMT_VALUES(uuid) \
- (uuid)[0], (uuid)[1], (uuid)[2], (uuid)[3], (uuid)[4], (uuid)[5], \
- (uuid)[6], (uuid)[7], (uuid)[8], (uuid)[9], (uuid)[10], (uuid)[11], \
- (uuid)[12], (uuid)[13], (uuid)[14], (uuid)[15]
+#define LTTNG_UUID_FMT_VALUES(uuid) \
+ (uuid)[0], (uuid)[1], (uuid)[2], (uuid)[3], (uuid)[4], (uuid)[5], (uuid)[6], (uuid)[7], \
+ (uuid)[8], (uuid)[9], (uuid)[10], (uuid)[11], (uuid)[12], (uuid)[13], (uuid)[14], \
+ (uuid)[15]
-#define LTTNG_UUID_SCAN_VALUES(uuid) \
- &(uuid)[0], &(uuid)[1], &(uuid)[2], &(uuid)[3], &(uuid)[4], &(uuid)[5], \
- &(uuid)[6], &(uuid)[7], &(uuid)[8], &(uuid)[9], &(uuid)[10], &(uuid)[11], \
- &(uuid)[12], &(uuid)[13], &(uuid)[14], &(uuid)[15]
+#define LTTNG_UUID_SCAN_VALUES(uuid) \
+ &(uuid)[0], &(uuid)[1], &(uuid)[2], &(uuid)[3], &(uuid)[4], &(uuid)[5], &(uuid)[6], \
+ &(uuid)[7], &(uuid)[8], &(uuid)[9], &(uuid)[10], &(uuid)[11], &(uuid)[12], \
+ &(uuid)[13], &(uuid)[14], &(uuid)[15]
using lttng_uuid = std::array<uint8_t, LTTNG_UUID_LEN>;
#define _LGPL_SOURCE
+#include "macros.hpp"
+
+#include <stdbool.h>
#include <stdint.h>
#include <urcu/wfstack.h>
-#include <stdbool.h>
-#include "macros.hpp"
struct lttng_waiter {
struct cds_wfs_node wait_queue_node;
#define _LGPL_SOURCE
#include "lttng-ctl-helper.hpp"
-#include <common/compiler.hpp>
#include <common/compat/errno.hpp>
+#include <common/compiler.hpp>
#include <common/defaults.hpp>
#include <common/utils.hpp>
#ifndef LTTNG_CTL_HELPER_H
#define LTTNG_CTL_HELPER_H
-#include <stdio.h>
-
#include <common/sessiond-comm/sessiond-comm.hpp>
+
#include <lttng/lttng.h>
+#include <stdio.h>
+
/* Copy helper functions. */
-void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst,
- struct lttng_domain *src);
+void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst, struct lttng_domain *src);
/*
* Sends the lttcomm message to the session daemon and fills buf if the
* error code. If buf is NULL, 0 is returned on success.
*/
int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
- const int *fds, size_t nb_fd,
- const void *vardata, size_t vardata_len,
- void **user_payload_buf, void **user_cmd_header_buf,
- size_t *user_cmd_header_len);
+ const int *fds,
+ size_t nb_fd,
+ const void *vardata,
+ size_t vardata_len,
+ void **user_payload_buf,
+ void **user_cmd_header_buf,
+ size_t *user_cmd_header_len);
/*
* Sends the lttcomm message to the session daemon and fills the reply payload.
* Return the size of the received data on success or else a negative lttng
* error code.
*/
-int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
- struct lttng_payload *reply);
+int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message, struct lttng_payload *reply);
/*
* Calls lttng_ctl_ask_sessiond_fds_varlen() with no expected command header.
*/
-static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header(
- struct lttcomm_session_msg *lsm,
- const void *vardata,
- size_t vardata_len,
- void **user_payload_buf)
+static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header(struct lttcomm_session_msg *lsm,
+ const void *vardata,
+ size_t vardata_len,
+ void **user_payload_buf)
{
- return lttng_ctl_ask_sessiond_fds_varlen(lsm, NULL, 0, vardata,
- vardata_len, user_payload_buf, NULL, NULL);
+ return lttng_ctl_ask_sessiond_fds_varlen(
+ lsm, NULL, 0, vardata, vardata_len, user_payload_buf, NULL, NULL);
}
/*
* Calls lttng_ctl_ask_sessiond_fds_varlen() with fds and no expected command header.
*/
-static inline
-int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm,
- const int *fds, size_t nb_fd, void **buf __attribute__((unused)))
+static inline int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm,
+ const int *fds,
+ size_t nb_fd,
+ void **buf __attribute__((unused)))
{
- return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL,
- 0, NULL, NULL, NULL);
+ return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL, 0, NULL, NULL, NULL);
}
/*
* Use this if no variable length data needs to be sent.
*/
-static inline
-int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf)
+static inline int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf)
{
return lttng_ctl_ask_sessiond_varlen_no_cmd_header(lsm, NULL, 0, buf);
}
*/
#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
#include <linux/perf_event.h>
#include <perfmon/perf_event.h>
#include <perfmon/pfmlib_perf_event.h>
+#include <stdio.h>
+#include <string.h>
int main(int argc, char **argv)
{
struct perf_event_attr attr;
if (argc != 2) {
- fprintf(stderr, "Usage: %s <pmu counter to find>\n"
- "ex: %s UNHALTED_REFERENCE_CYCLES\n"
- "Returns the event raw number if found and actionable with"
- "return code 0.\n"
- "If not found returns 1,"
- "If not actionable return 2,"
- "on error returns 255\n",
- argv[0], argv[0]);
+ fprintf(stderr,
+ "Usage: %s <pmu counter to find>\n"
+ "ex: %s UNHALTED_REFERENCE_CYCLES\n"
+ "Returns the event raw number if found and actionable with"
+ "return code 0.\n"
+ "If not found returns 1,"
+ "If not actionable return 2,"
+ "on error returns 255\n",
+ argv[0],
+ argv[0]);
ret = -1;
goto end;
}
ret = pfm_initialize();
if (ret != PFM_SUCCESS) {
- fprintf(stderr, "Failed to initialise libpfm: %s",
- pfm_strerror(ret));
+ fprintf(stderr, "Failed to initialise libpfm: %s", pfm_strerror(ret));
ret = 255;
goto end;
}
- ret = pfm_get_os_event_encoding(argv[1],
- PFM_PLM0 | PFM_PLM1 | PFM_PLM2 | PFM_PLM3,
- PFM_OS_PERF_EVENT, &pencoder);
+ ret = pfm_get_os_event_encoding(
+ argv[1], PFM_PLM0 | PFM_PLM1 | PFM_PLM2 | PFM_PLM3, PFM_OS_PERF_EVENT, &pencoder);
if (ret != PFM_SUCCESS) {
- fprintf(stderr, "libpfm: error pfm_get_os_event_encoding: %s\n",
- pfm_strerror(ret));
+ fprintf(stderr, "libpfm: error pfm_get_os_event_encoding: %s\n", pfm_strerror(ret));
ret = 1;
goto end;
}
/* perf_event_open is provided by perfmon/perf_event.h. */
fd = perf_event_open(pencoder.attr, 0, -1, -1, 0);
if (fd == -1) {
- fprintf(stderr, "perf: error perf_event_open: %d: %s\n", errno,
- strerror(errno));
+ fprintf(stderr, "perf: error perf_event_open: %d: %s\n", errno, strerror(errno));
ret = 2;
goto end;
}
for (i = 0; i < nr_iter; i++) {
netint = htonl(i);
- tracepoint(tp, tptest, i, netint, values, text, strlen(text), escape, dbl, flt,
- net_values);
+ tracepoint(tp,
+ tptest,
+ i,
+ netint,
+ values,
+ text,
+ strlen(text),
+ escape,
+ dbl,
+ flt,
+ net_values);
usleep(nr_usec);
}
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(tp, tptest,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- char *, etext, double, doublearg, float, floatarg,
- uint32_t *, net_values),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_array_network(uint32_t, arrfield3, net_values, 3)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_sequence_network(uint32_t, seqfield3, net_values, size_t, 3)
- ctf_sequence(long, seqfield4, values, size_t, 3)
- ctf_string(stringfield, text)
- ctf_string(stringfield2, etext)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
+TRACEPOINT_EVENT(
+ tp,
+ tptest,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ char *,
+ etext,
+ double,
+ doublearg,
+ float,
+ floatarg,
+ uint32_t *,
+ net_values),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_array_network(
+ uint32_t,
+ arrfield3,
+ net_values,
+ 3) ctf_sequence(char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_sequence_network(uint32_t,
+ seqfield3,
+ net_values,
+ size_t,
+ 3) ctf_sequence(long,
+ seqfield4,
+ values,
+ size_t,
+ 3)
+ ctf_string(stringfield,
+ text) ctf_string(stringfield2,
+ etext)
+ ctf_float(float,
+ floatfield,
+ floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
#endif /* _TRACEPOINT_TP_H */
*
*/
+#include <lttng/health.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <lttng/health.h>
-
static const char *relayd_path;
-static
-int check_component(struct lttng_health *lh, const char *component_name,
- int ok_if_not_running)
+static int
+check_component(struct lttng_health *lh, const char *component_name, int ok_if_not_running)
{
const struct lttng_health_thread *thread;
int nr_threads, i, status;
if (ok_if_not_running) {
return 0;
}
- fprintf(stderr, "Error querying %s health\n",
- component_name);
+ fprintf(stderr, "Error querying %s health\n", component_name);
return -1;
}
status = lttng_health_state(lh);
continue;
}
printf("Thread \"%s\" is not responding in component \"%s\".\n",
- lttng_health_thread_name(thread),
- component_name);
-
+ lttng_health_thread_name(thread),
+ component_name);
}
return status;
}
-static
-int check_sessiond(void)
+static int check_sessiond(void)
{
struct lttng_health *lh;
int status;
return status;
}
-static
-int check_consumerd(enum lttng_health_consumerd hc)
+static int check_consumerd(enum lttng_health_consumerd hc)
{
struct lttng_health *lh;
int status;
return status;
}
-static
-int check_relayd(const char *path)
+static int check_relayd(const char *path)
{
struct lttng_health *lh;
int status;
for (i = 1; i < argc; i++) {
size_t relayd_path_arg_len = strlen("--relayd-path=");
- if (!strncmp(argv[i], "--relayd-path=",
- relayd_path_arg_len)) {
+ if (!strncmp(argv[i], "--relayd-path=", relayd_path_arg_len)) {
relayd_path = &argv[i][relayd_path_arg_len];
} else {
- fprintf(stderr, "Unknown option \"%s\". Try --relayd-path=PATH.\n", argv[i]);
+ fprintf(stderr,
+ "Unknown option \"%s\". Try --relayd-path=PATH.\n",
+ argv[i]);
exit(EXIT_FAILURE);
}
}
*/
#include <lttng/lttng-export.h>
+
+#include <pthread.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
#include <urcu.h>
/*
* Check if the specified environment variable is set.
* Return 1 if set, otherwise 0.
*/
-static
-int check_env_var(const char *env)
+static int check_env_var(const char *env)
{
if (env) {
char *env_val = getenv(env);
*/
#include <lttng/lttng-export.h>
+
+#include <pthread.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
#include <unistd.h>
#include <urcu.h>
* Check if the specified environment variable is set.
* Return 1 if set, otherwise 0.
*/
-static
-int check_env_var(const char *env)
+static int check_env_var(const char *env)
{
if (env) {
char *env_val = getenv(env);
return 0;
}
-static
-void do_stall(void)
+static void do_stall(void)
{
unsigned int sleep_time = STALL_TIME;
*
*/
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include <unistd.h>
-#include <inttypes.h>
-
#include <lttng/action/action.h>
#include <lttng/action/list.h>
#include <lttng/action/notify.h>
#include <lttng/condition/evaluation.h>
#include <lttng/domain.h>
#include <lttng/endpoint.h>
+#include <lttng/lttng-error.h>
#include <lttng/notification/channel.h>
#include <lttng/notification/notification.h>
#include <lttng/trigger/trigger.h>
-#include <lttng/lttng-error.h>
+
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
static unsigned int nr_notifications = 0;
static unsigned int nr_expected_notifications = 0;
static enum lttng_condition_type buffer_usage_type = LTTNG_CONDITION_TYPE_UNKNOWN;
static enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE;
-int handle_condition(
- const struct lttng_condition *condition,
- const struct lttng_evaluation *condition_evaluation);
+int handle_condition(const struct lttng_condition *condition,
+ const struct lttng_evaluation *condition_evaluation);
-static
-int parse_arguments(char **argv)
+static int parse_arguments(char **argv)
{
int sscanf_ret;
const char *domain_type_string = NULL;
/* Ratio or bytes ? */
if (!strcasecmp("bytes", buffer_usage_threshold_type)) {
is_threshold_ratio = false;
- sscanf_ret = sscanf(buffer_usage_threshold_value, "%" SCNu64,
- &threshold_bytes);
+ sscanf_ret = sscanf(buffer_usage_threshold_value, "%" SCNu64, &threshold_bytes);
if (sscanf_ret != 1) {
printf("error: Invalid buffer usage threshold value bytes (integer), sscanf returned %d\n",
- sscanf_ret);
+ sscanf_ret);
goto error;
}
}
if (!strcasecmp("ratio", buffer_usage_threshold_type)) {
is_threshold_ratio = true;
- sscanf_ret = sscanf(buffer_usage_threshold_value, "%lf",
- &threshold_ratio);
+ sscanf_ret = sscanf(buffer_usage_threshold_value, "%lf", &threshold_ratio);
if (sscanf_ret != 1) {
printf("error: Invalid buffer usage threshold value ratio (float), sscanf returned %d\n",
- sscanf_ret);
+ sscanf_ret);
goto error;
}
}
/* Number of notification to expect */
- sscanf_ret = sscanf(nr_expected_notifications_string, "%d",
- &nr_expected_notifications);
+ sscanf_ret = sscanf(nr_expected_notifications_string, "%d", &nr_expected_notifications);
if (sscanf_ret != 1) {
printf("error: Invalid nr_expected_notifications, sscanf returned %d\n",
- sscanf_ret);
+ sscanf_ret);
goto error;
}
}
/* Setup */
- notification_channel = lttng_notification_channel_create(
- lttng_session_daemon_notification_endpoint);
+ notification_channel =
+ lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
if (!notification_channel) {
printf("error: Could not create notification channel\n");
ret = 1;
if (is_threshold_ratio) {
condition_status = lttng_condition_buffer_usage_set_threshold_ratio(
- condition, threshold_ratio);
+ condition, threshold_ratio);
} else {
- condition_status = lttng_condition_buffer_usage_set_threshold(
- condition, threshold_bytes);
+ condition_status =
+ lttng_condition_buffer_usage_set_threshold(condition, threshold_bytes);
}
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
goto end;
}
- condition_status = lttng_condition_buffer_usage_set_session_name(
- condition, session_name);
+ condition_status = lttng_condition_buffer_usage_set_session_name(condition, session_name);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
printf("error: Could not set session name\n");
ret = 1;
goto end;
}
- condition_status = lttng_condition_buffer_usage_set_channel_name(
- condition, channel_name);
+ condition_status = lttng_condition_buffer_usage_set_channel_name(condition, channel_name);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
printf("error: Could not set channel name\n");
ret = 1;
goto end;
}
- condition_status = lttng_condition_buffer_usage_set_domain_type(
- condition, domain_type);
+ condition_status = lttng_condition_buffer_usage_set_domain_type(condition, domain_type);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
printf("error: Could not set domain type\n");
ret = 1;
goto end;
}
/* Receive the next notification. */
- status = lttng_notification_channel_get_next_notification(
- notification_channel,
- ¬ification);
+ status = lttng_notification_channel_get_next_notification(notification_channel,
+ ¬ification);
switch (status) {
case LTTNG_NOTIFICATION_CHANNEL_STATUS_OK:
return ret;
}
-int handle_condition(
- const struct lttng_condition *condition,
- const struct lttng_evaluation *evaluation)
+int handle_condition(const struct lttng_condition *condition,
+ const struct lttng_evaluation *evaluation)
{
int ret = 0;
const char *string_low = "low";
}
/* Fetch info to test */
- ret = lttng_condition_buffer_usage_get_session_name(condition,
- &condition_session_name);
+ ret = lttng_condition_buffer_usage_get_session_name(condition, &condition_session_name);
if (ret) {
printf("error: session name could not be fetched\n");
ret = 1;
goto end;
}
- ret = lttng_condition_buffer_usage_get_channel_name(condition,
- &condition_channel_name);
+ ret = lttng_condition_buffer_usage_get_channel_name(condition, &condition_channel_name);
if (ret) {
printf("error: channel name could not be fetched\n");
ret = 1;
goto end;
}
- ret = lttng_condition_buffer_usage_get_domain_type(condition,
- &condition_domain_type);
+ ret = lttng_condition_buffer_usage_get_domain_type(condition, &condition_domain_type);
if (ret) {
printf("error: domain type could not be fetched\n");
ret = 1;
}
if (is_threshold_ratio) {
- lttng_evaluation_buffer_usage_get_usage_ratio(
- evaluation, &buffer_usage_ratio);
+ lttng_evaluation_buffer_usage_get_usage_ratio(evaluation, &buffer_usage_ratio);
switch (condition_type) {
case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
if (buffer_usage_ratio > threshold_ratio) {
goto end;
}
} else {
- lttng_evaluation_buffer_usage_get_usage(
- evaluation, &buffer_usage_bytes);
+ lttng_evaluation_buffer_usage_get_usage(evaluation, &buffer_usage_bytes);
switch (condition_type) {
case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
if (buffer_usage_bytes > threshold_bytes) {
*
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <tap/tap.h>
+#include <lttng/lttng.h>
+
#include <stdint.h>
+#include <stdio.h>
#include <string.h>
-#include <lttng/lttng.h>
+#include <tap/tap.h>
+#include <unistd.h>
#define TEST_COUNT 36
uint64_t expected_rotation_id = UINT64_MAX;
-static
-int test_condition(struct lttng_condition *condition, const char *type_name)
+static int test_condition(struct lttng_condition *condition, const char *type_name)
{
int ret = 0;
const char *out_session_name;
- const char * const session_name = "test session name";
+ const char *const session_name = "test session name";
enum lttng_condition_status status;
- status = lttng_condition_session_rotation_get_session_name(condition,
- &out_session_name);
+ status = lttng_condition_session_rotation_get_session_name(condition, &out_session_name);
ok(status == LTTNG_CONDITION_STATUS_UNSET,
- "Getting unset name of %s condition fails with LTTNG_CONDITION_STATUS_UNSET",
- type_name);
+ "Getting unset name of %s condition fails with LTTNG_CONDITION_STATUS_UNSET",
+ type_name);
- status = lttng_condition_session_rotation_set_session_name(condition,
- session_name);
+ status = lttng_condition_session_rotation_set_session_name(condition, session_name);
ok(status == LTTNG_CONDITION_STATUS_OK,
- "Setting session name \"%s\" of %s condition succeeds",
- session_name, type_name);
+ "Setting session name \"%s\" of %s condition succeeds",
+ session_name,
+ type_name);
- status = lttng_condition_session_rotation_get_session_name(condition,
- &out_session_name);
- ok(status == LTTNG_CONDITION_STATUS_OK,
- "Getting name of %s condition succeeds",
- type_name);
+ status = lttng_condition_session_rotation_get_session_name(condition, &out_session_name);
+ ok(status == LTTNG_CONDITION_STATUS_OK, "Getting name of %s condition succeeds", type_name);
ok(out_session_name && !strcmp(session_name, out_session_name),
- "Session name returned by %s condition matches the expected name",
- type_name);
+ "Session name returned by %s condition matches the expected name",
+ type_name);
return ret;
}
-static
-int setup_rotation_trigger(const struct session *session,
- struct lttng_notification_channel *notification_channel)
+static int setup_rotation_trigger(const struct session *session,
+ struct lttng_notification_channel *notification_channel)
{
int ret;
struct lttng_condition *rotation_ongoing_condition = NULL;
}
/* Create rotation ongoing and completed conditions. */
- rotation_ongoing_condition =
- lttng_condition_session_rotation_ongoing_create();
+ rotation_ongoing_condition = lttng_condition_session_rotation_ongoing_create();
ok(rotation_ongoing_condition, "Create session rotation ongoing condition");
if (!rotation_ongoing_condition) {
ret = -1;
goto end;
}
condition_status = lttng_condition_session_rotation_set_session_name(
- rotation_ongoing_condition, session->name);
+ rotation_ongoing_condition, session->name);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
ret = -1;
diag("Failed to set session name on session rotation ongoing condition");
goto end;
}
- rotation_completed_condition =
- lttng_condition_session_rotation_completed_create();
+ rotation_completed_condition = lttng_condition_session_rotation_completed_create();
ok(rotation_completed_condition, "Create session rotation completed condition");
if (!rotation_completed_condition) {
ret = -1;
goto end;
}
condition_status = lttng_condition_session_rotation_set_session_name(
- rotation_completed_condition, session->name);
+ rotation_completed_condition, session->name);
if (condition_status != LTTNG_CONDITION_STATUS_OK) {
ret = -1;
goto end;
}
notification_channel_status = lttng_notification_channel_subscribe(
- notification_channel, rotation_ongoing_condition);
+ notification_channel, rotation_ongoing_condition);
ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
- "Subscribe to session rotation ongoing notifications");
- if (notification_channel_status !=
- LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
+ "Subscribe to session rotation ongoing notifications");
+ if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
ret = -1;
goto end;
}
notification_channel_status = lttng_notification_channel_subscribe(
- notification_channel, rotation_completed_condition);
+ notification_channel, rotation_completed_condition);
ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
- "Subscribe to session rotation completed notifications");
- if (notification_channel_status !=
- LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
+ "Subscribe to session rotation completed notifications");
+ if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
ret = -1;
goto end;
}
/* Create rotation ongoing and completed triggers. */
- rotation_ongoing_trigger = lttng_trigger_create(
- rotation_ongoing_condition, notify);
+ rotation_ongoing_trigger = lttng_trigger_create(rotation_ongoing_condition, notify);
ok(rotation_ongoing_trigger, "Create a rotation ongoing notification trigger");
if (!rotation_ongoing_trigger) {
ret = -1;
goto end;
}
- rotation_completed_trigger = lttng_trigger_create(
- rotation_completed_condition, notify);
+ rotation_completed_trigger = lttng_trigger_create(rotation_completed_condition, notify);
ok(rotation_completed_trigger, "Create a rotation completed notification trigger");
if (!rotation_completed_trigger) {
ret = -1;
}
/* Register rotation ongoing and completed triggers. */
- ret_code = lttng_register_trigger_with_automatic_name(
- rotation_ongoing_trigger);
+ ret_code = lttng_register_trigger_with_automatic_name(rotation_ongoing_trigger);
ok(ret_code == LTTNG_OK, "Registered session rotation ongoing trigger");
if (ret_code != LTTNG_OK) {
ret = -ret_code;
goto end;
}
- ret_code = lttng_register_trigger_with_automatic_name(
- rotation_completed_trigger);
- ok(ret_code == LTTNG_OK,
- "Registered session rotation completed trigger");
+ ret_code = lttng_register_trigger_with_automatic_name(rotation_completed_trigger);
+ ok(ret_code == LTTNG_OK, "Registered session rotation completed trigger");
if (ret_code != LTTNG_OK) {
ret = -ret_code;
goto end;
return ret;
}
-static
-int test_notification(
- struct lttng_notification_channel *notification_channel,
- const struct session *session,
- const char *expected_notification_type_name,
- enum lttng_condition_type expected_condition_type)
+static int test_notification(struct lttng_notification_channel *notification_channel,
+ const struct session *session,
+ const char *expected_notification_type_name,
+ enum lttng_condition_type expected_condition_type)
{
int ret = 0;
bool notification_pending;
const char *chunk_path = NULL;
notification_channel_status = lttng_notification_channel_has_pending_notification(
- notification_channel, ¬ification_pending);
+ notification_channel, ¬ification_pending);
ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
- "Check for %s notification pending on notification channel",
- expected_notification_type_name);
+ "Check for %s notification pending on notification channel",
+ expected_notification_type_name);
if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
ret = -1;
goto end;
}
ok(notification_pending,
- "Session %s notification is pending on notification channel",
- expected_notification_type_name);
+ "Session %s notification is pending on notification channel",
+ expected_notification_type_name);
if (!notification_pending) {
ret = -1;
goto end;
}
notification_channel_status = lttng_notification_channel_get_next_notification(
- notification_channel, ¬ification);
+ notification_channel, ¬ification);
ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification,
- "Get %s notification from notification channel",
- expected_notification_type_name);
+ "Get %s notification from notification channel",
+ expected_notification_type_name);
if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK || !notification) {
ret = -1;
goto end;
condition_type = lttng_condition_get_type(condition);
ok(condition_type == expected_condition_type,
- "Notification condition obtained from notification channel is of type \"%s\"",
- expected_notification_type_name);
+ "Notification condition obtained from notification channel is of type \"%s\"",
+ expected_notification_type_name);
if (condition_type != expected_condition_type) {
ret = -1;
goto end;
}
- condition_status = lttng_condition_session_rotation_get_session_name(
- condition, &session_name);
+ condition_status =
+ lttng_condition_session_rotation_get_session_name(condition, &session_name);
ok(condition_status == LTTNG_CONDITION_STATUS_OK && session_name &&
- !strcmp(session_name, session->name),
- "Condition obtained from notification has the correct session name assigned");
+ !strcmp(session_name, session->name),
+ "Condition obtained from notification has the correct session name assigned");
if (condition_status != LTTNG_CONDITION_STATUS_OK || !session_name) {
ret = -1;
goto end;
}
condition_type = lttng_evaluation_get_type(evaluation);
ok(condition_type == expected_condition_type,
- "Condition evaluation obtained from notification channel is of type \"%s\"",
- expected_notification_type_name);
+ "Condition evaluation obtained from notification channel is of type \"%s\"",
+ expected_notification_type_name);
if (condition_type != expected_condition_type) {
ret = -1;
goto end;
}
- evaluation_status = lttng_evaluation_session_rotation_get_id(evaluation,
- &rotation_id);
+ evaluation_status = lttng_evaluation_session_rotation_get_id(evaluation, &rotation_id);
ok(evaluation_status == LTTNG_EVALUATION_STATUS_OK,
- "Get %s id from notification evaluation",
- expected_notification_type_name);
+ "Get %s id from notification evaluation",
+ expected_notification_type_name);
if (evaluation_status != LTTNG_EVALUATION_STATUS_OK) {
ret = -1;
goto end;
goto end;
}
- evaluation_status = lttng_evaluation_session_rotation_completed_get_location(
- evaluation, &location);
+ evaluation_status =
+ lttng_evaluation_session_rotation_completed_get_location(evaluation, &location);
ok(evaluation_status == LTTNG_EVALUATION_STATUS_OK && location,
- "Get session %s chunk location from evaluation",
- expected_notification_type_name);
+ "Get session %s chunk location from evaluation",
+ expected_notification_type_name);
if (evaluation_status != LTTNG_EVALUATION_STATUS_OK || !location) {
ret = -1;
goto end;
}
- ok(lttng_trace_archive_location_get_type(location) == LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL,
- "Location returned from the session rotation completed notification is of type 'local'");
+ ok(lttng_trace_archive_location_get_type(location) ==
+ LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL,
+ "Location returned from the session rotation completed notification is of type 'local'");
- location_status = lttng_trace_archive_location_local_get_absolute_path(
- location, &chunk_path);
+ location_status =
+ lttng_trace_archive_location_local_get_absolute_path(location, &chunk_path);
ok(location_status == LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK && chunk_path,
- "Retrieved path from location returned by the session rotation completed notification");
+ "Retrieved path from location returned by the session rotation completed notification");
diag("Chunk available at %s", chunk_path ? chunk_path : "NULL");
ok(chunk_path && !strncmp(session->output_path, chunk_path, strlen(session->output_path)),
- "Returned path from location starts with the output path");
+ "Returned path from location starts with the output path");
end:
lttng_notification_destroy(notification);
return ret;
}
-static
-int test_rotation_ongoing_notification(
- struct lttng_notification_channel *notification_channel,
- struct session *session)
+static int
+test_rotation_ongoing_notification(struct lttng_notification_channel *notification_channel,
+ struct session *session)
{
- return test_notification(notification_channel, session,
- "rotation ongoing",
- LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
+ return test_notification(notification_channel,
+ session,
+ "rotation ongoing",
+ LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
}
-static
-int test_rotation_completed_notification(
- struct lttng_notification_channel *notification_channel,
- struct session *session)
+static int
+test_rotation_completed_notification(struct lttng_notification_channel *notification_channel,
+ struct session *session)
{
- return test_notification(notification_channel, session,
- "rotation completed",
- LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
+ return test_notification(notification_channel,
+ session,
+ "rotation completed",
+ LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
}
int main(int argc, const char *argv[])
struct lttng_notification_channel *notification_channel = NULL;
struct lttng_rotation_handle *rotation_handle = NULL;
enum lttng_rotation_status rotation_status;
- enum lttng_rotation_state rotation_state =
- LTTNG_ROTATION_STATE_NO_ROTATION;
+ enum lttng_rotation_state rotation_state = LTTNG_ROTATION_STATE_NO_ROTATION;
if (argc != 3) {
puts("Usage: rotation SESSION_NAME SESSION_OUTPUT_PATH");
plan_tests(TEST_COUNT);
- notification_channel = lttng_notification_channel_create(
- lttng_session_daemon_notification_endpoint);
+ notification_channel =
+ lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
if (!notification_channel) {
diag("Failed to create notification channel");
ret = -1;
/* Start rotation and wait for its completion. */
ret = lttng_rotate_session(session.name, NULL, &rotation_handle);
- ok(ret >= 0 && rotation_handle, "Start rotation of session \"%s\"",
- session.name);
+ ok(ret >= 0 && rotation_handle, "Start rotation of session \"%s\"", session.name);
if (ret < 0 || !rotation_handle) {
goto error;
}
do {
- rotation_status = lttng_rotation_handle_get_state(
- rotation_handle, &rotation_state);
+ rotation_status = lttng_rotation_handle_get_state(rotation_handle, &rotation_state);
} while (rotation_state == LTTNG_ROTATION_STATE_ONGOING &&
- rotation_status == LTTNG_ROTATION_STATUS_OK);
+ rotation_status == LTTNG_ROTATION_STATUS_OK);
ok(rotation_status == LTTNG_ROTATION_STATUS_OK &&
- rotation_state == LTTNG_ROTATION_STATE_COMPLETED,
- "Complete rotation of session \"%s\"", session.name);
+ rotation_state == LTTNG_ROTATION_STATE_COMPLETED,
+ "Complete rotation of session \"%s\"",
+ session.name);
/*
* After a rotation has completed, we can expect two notifications to
* - Session rotation ongoing
* - Session rotation completed
*/
- ret = test_rotation_ongoing_notification(notification_channel,
- &session);
+ ret = test_rotation_ongoing_notification(notification_channel, &session);
if (ret) {
goto error;
}
- ret = test_rotation_completed_notification(notification_channel,
- &session);
+ ret = test_rotation_completed_notification(notification_channel, &session);
if (ret) {
goto error;
}
*
*/
-#include <stddef.h>
+#include <lttng/lttng.h>
+
#include <stdbool.h>
+#include <stddef.h>
#include <tap/tap.h>
-#include <lttng/lttng.h>
-
#define NUM_TESTS 26
#define SIZE_THRESHOLD_BYTES 1024
-#define PERIODIC_TIME_US 1000000
+#define PERIODIC_TIME_US 1000000
const char *session_name;
-static
-bool schedules_equal(const struct lttng_rotation_schedule *a,
- const struct lttng_rotation_schedule *b)
+static bool schedules_equal(const struct lttng_rotation_schedule *a,
+ const struct lttng_rotation_schedule *b)
{
bool equal = false;
enum lttng_rotation_schedule_type a_type, b_type;
a_type = lttng_rotation_schedule_get_type(a);
b_type = lttng_rotation_schedule_get_type(b);
if (a_type != b_type) {
- diag("Schedules are not of the same type (%i != %i)",
- a_type, b_type);
+ diag("Schedules are not of the same type (%i != %i)", a_type, b_type);
goto end;
}
switch (a_type) {
case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
{
- status = lttng_rotation_schedule_size_threshold_get_threshold(a,
- &a_value);
+ status = lttng_rotation_schedule_size_threshold_get_threshold(a, &a_value);
if (status != LTTNG_ROTATION_STATUS_OK) {
diag("Failed to retrieve size threshold of schedule 'a'");
goto end;
}
- status = lttng_rotation_schedule_size_threshold_get_threshold(b,
- &b_value);
+ status = lttng_rotation_schedule_size_threshold_get_threshold(b, &b_value);
if (status != LTTNG_ROTATION_STATUS_OK) {
diag("Failed to retrieve size threshold of schedule 'b'");
goto end;
}
case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
{
- status = lttng_rotation_schedule_periodic_get_period(a,
- &a_value);
+ status = lttng_rotation_schedule_periodic_get_period(a, &a_value);
if (status != LTTNG_ROTATION_STATUS_OK) {
diag("Failed to retrieve period of schedule 'a'");
goto end;
}
- status = lttng_rotation_schedule_periodic_get_period(b,
- &b_value);
+ status = lttng_rotation_schedule_periodic_get_period(b, &b_value);
if (status != LTTNG_ROTATION_STATUS_OK) {
diag("Failed to retrieve period of schedule 'b'");
goto end;
return equal;
}
-static
-void test_add_null_session(void)
+static void test_add_null_session(void)
{
enum lttng_rotation_status status;
struct lttng_rotation_schedule *size_schedule = NULL;
status = lttng_session_add_rotation_schedule(NULL, size_schedule);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "NULL session name rejected by lttng_session_add_rotation_schedule()");
+ "NULL session name rejected by lttng_session_add_rotation_schedule()");
lttng_rotation_schedule_destroy(size_schedule);
}
-static
-void test_add_null_schedule(void)
+static void test_add_null_schedule(void)
{
enum lttng_rotation_status status;
status = lttng_session_add_rotation_schedule(session_name, NULL);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "NULL schedule rejected by lttng_session_add_rotation_schedule()");
+ "NULL schedule rejected by lttng_session_add_rotation_schedule()");
}
-static
-void test_add_uninitialized_schedule(void)
+static void test_add_uninitialized_schedule(void)
{
enum lttng_rotation_status status;
- struct lttng_rotation_schedule *size_schedule = NULL,
- *periodic_schedule = NULL;
+ struct lttng_rotation_schedule *size_schedule = NULL, *periodic_schedule = NULL;
size_schedule = lttng_rotation_schedule_size_threshold_create();
ok(size_schedule, "Created a size threshold session rotation schedule");
- status = lttng_session_add_rotation_schedule(session_name,
- size_schedule);
+ status = lttng_session_add_rotation_schedule(session_name, size_schedule);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "Uninitialized size schedule rejected by lttng_session_add_rotation_schedule()");
+ "Uninitialized size schedule rejected by lttng_session_add_rotation_schedule()");
periodic_schedule = lttng_rotation_schedule_periodic_create();
ok(periodic_schedule, "Created a periodic session rotation schedule");
- status = lttng_session_add_rotation_schedule(session_name,
- periodic_schedule);
+ status = lttng_session_add_rotation_schedule(session_name, periodic_schedule);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "Uninitialized periodic schedule rejected by lttng_session_add_rotation_schedule()");
+ "Uninitialized periodic schedule rejected by lttng_session_add_rotation_schedule()");
lttng_rotation_schedule_destroy(size_schedule);
lttng_rotation_schedule_destroy(periodic_schedule);
}
-static
-void test_remove_null_session(void)
+static void test_remove_null_session(void)
{
enum lttng_rotation_status status;
struct lttng_rotation_schedule *size_schedule = NULL;
status = lttng_session_remove_rotation_schedule(NULL, size_schedule);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "NULL session name rejected by lttng_session_remove_rotation_schedule()");
+ "NULL session name rejected by lttng_session_remove_rotation_schedule()");
lttng_rotation_schedule_destroy(size_schedule);
}
-static
-void test_remove_null_schedule(void)
+static void test_remove_null_schedule(void)
{
enum lttng_rotation_status status;
status = lttng_session_remove_rotation_schedule(session_name, NULL);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "NULL schedule rejected by lttng_session_remove_rotation_schedule()");
+ "NULL schedule rejected by lttng_session_remove_rotation_schedule()");
}
-static
-void test_remove_uninitialized_schedule(void)
+static void test_remove_uninitialized_schedule(void)
{
enum lttng_rotation_status status;
- struct lttng_rotation_schedule *size_schedule = NULL,
- *periodic_schedule = NULL;
+ struct lttng_rotation_schedule *size_schedule = NULL, *periodic_schedule = NULL;
size_schedule = lttng_rotation_schedule_size_threshold_create();
- status = lttng_session_remove_rotation_schedule(session_name,
- size_schedule);
+ status = lttng_session_remove_rotation_schedule(session_name, size_schedule);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "Uninitialized size schedule rejected by lttng_session_remove_rotation_schedule()");
+ "Uninitialized size schedule rejected by lttng_session_remove_rotation_schedule()");
periodic_schedule = lttng_rotation_schedule_periodic_create();
- status = lttng_session_remove_rotation_schedule(session_name,
- periodic_schedule);
+ status = lttng_session_remove_rotation_schedule(session_name, periodic_schedule);
ok(status == LTTNG_ROTATION_STATUS_INVALID,
- "Uninitialized periodic schedule rejected by lttng_session_remove_rotation_schedule()");
+ "Uninitialized periodic schedule rejected by lttng_session_remove_rotation_schedule()");
lttng_rotation_schedule_destroy(size_schedule);
lttng_rotation_schedule_destroy(periodic_schedule);
}
-static
-void test_uninitialized_schedule_get(void)
+static void test_uninitialized_schedule_get(void)
{
uint64_t value;
enum lttng_rotation_status status;
- struct lttng_rotation_schedule *size_schedule = NULL,
- *periodic_schedule = NULL;
+ struct lttng_rotation_schedule *size_schedule = NULL, *periodic_schedule = NULL;
size_schedule = lttng_rotation_schedule_size_threshold_create();
periodic_schedule = lttng_rotation_schedule_periodic_create();
- status = lttng_rotation_schedule_size_threshold_get_threshold(
- size_schedule, &value);
+ status = lttng_rotation_schedule_size_threshold_get_threshold(size_schedule, &value);
ok(status == LTTNG_ROTATION_STATUS_UNAVAILABLE,
- "Getter on size threshold rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default");
- status = lttng_rotation_schedule_periodic_get_period(periodic_schedule,
- &value);
+ "Getter on size threshold rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default");
+ status = lttng_rotation_schedule_periodic_get_period(periodic_schedule, &value);
ok(status == LTTNG_ROTATION_STATUS_UNAVAILABLE,
- "Getter on periodic rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default");
+ "Getter on periodic rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default");
lttng_rotation_schedule_destroy(size_schedule);
lttng_rotation_schedule_destroy(periodic_schedule);
-
}
-static
-void test_add_list_remove_schedule(
- const struct lttng_rotation_schedule *original_schedule)
+static void test_add_list_remove_schedule(const struct lttng_rotation_schedule *original_schedule)
{
int ret;
unsigned int schedules_count = 0;
const struct lttng_rotation_schedule *list_schedule;
struct lttng_rotation_schedules *list_schedules;
- status = lttng_session_add_rotation_schedule(session_name,
- original_schedule);
+ status = lttng_session_add_rotation_schedule(session_name, original_schedule);
ok(status == LTTNG_ROTATION_STATUS_OK,
- "Add a rotation schedule to session \'%s\'",
- session_name);
+ "Add a rotation schedule to session \'%s\'",
+ session_name);
- ret = lttng_session_list_rotation_schedules(session_name,
- &list_schedules);
+ ret = lttng_session_list_rotation_schedules(session_name, &list_schedules);
ok(ret == LTTNG_OK && list_schedules,
- "List rotation schedules of session \'%s\'",
- session_name);
+ "List rotation schedules of session \'%s\'",
+ session_name);
- status = lttng_rotation_schedules_get_count(list_schedules,
- &schedules_count);
+ status = lttng_rotation_schedules_get_count(list_schedules, &schedules_count);
ok(status == LTTNG_ROTATION_STATUS_OK && schedules_count == 1,
- "Listing returned 1 rotation schedule");
+ "Listing returned 1 rotation schedule");
- list_schedule = lttng_rotation_schedules_get_at_index(list_schedules,
- 0);
- ok(list_schedule,
- "Obtain the first schedule of a schedules list");
+ list_schedule = lttng_rotation_schedules_get_at_index(list_schedules, 0);
+ ok(list_schedule, "Obtain the first schedule of a schedules list");
ok(schedules_equal(original_schedule, list_schedule),
- "Schedule returned by the listing is equal to the reference schedule that was added");
+ "Schedule returned by the listing is equal to the reference schedule that was added");
- status = lttng_session_remove_rotation_schedule(session_name,
- list_schedule);
+ status = lttng_session_remove_rotation_schedule(session_name, list_schedule);
ok(status == LTTNG_ROTATION_STATUS_OK,
- "Remove rotation schedule returned by the schedules listing");
+ "Remove rotation schedule returned by the schedules listing");
lttng_rotation_schedules_destroy(list_schedules);
- (void) lttng_session_list_rotation_schedules(session_name,
- &list_schedules);
- status = lttng_rotation_schedules_get_count(list_schedules,
- &schedules_count);
+ (void) lttng_session_list_rotation_schedules(session_name, &list_schedules);
+ status = lttng_rotation_schedules_get_count(list_schedules, &schedules_count);
ok(status == LTTNG_ROTATION_STATUS_OK && schedules_count == 0,
- "Listing returned 0 rotation schedules after removal");
+ "Listing returned 0 rotation schedules after removal");
lttng_rotation_schedules_destroy(list_schedules);
}
-static
-void test_add_list_remove_size_schedule(void)
+static void test_add_list_remove_size_schedule(void)
{
struct lttng_rotation_schedule *size_schedule;
diag("Add, list, and remove a size threshold rotation schedule");
size_schedule = lttng_rotation_schedule_size_threshold_create();
- (void) lttng_rotation_schedule_size_threshold_set_threshold(
- size_schedule, SIZE_THRESHOLD_BYTES);
+ (void) lttng_rotation_schedule_size_threshold_set_threshold(size_schedule,
+ SIZE_THRESHOLD_BYTES);
test_add_list_remove_schedule(size_schedule);
lttng_rotation_schedule_destroy(size_schedule);
}
-static
-void test_add_list_remove_periodic_schedule(void)
+static void test_add_list_remove_periodic_schedule(void)
{
struct lttng_rotation_schedule *periodic_schedule;
diag("Add, list, and remove a periodic rotation schedule");
periodic_schedule = lttng_rotation_schedule_periodic_create();
- (void) lttng_rotation_schedule_periodic_set_period(
- periodic_schedule, PERIODIC_TIME_US);
+ (void) lttng_rotation_schedule_periodic_set_period(periodic_schedule, PERIODIC_TIME_US);
test_add_list_remove_schedule(periodic_schedule);
lttng_rotation_schedule_destroy(periodic_schedule);
}
*
*/
+#include "utils.h"
+
+#include <lttng/condition/event-rule-matches.h>
+#include <lttng/lttng.h>
+
#include <getopt.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/time.h>
#include <time.h>
-#include <lttng/condition/event-rule-matches.h>
-#include <lttng/lttng.h>
-
-#include "utils.h"
-
-static struct option long_options[] =
-{
+static struct option long_options[] = {
/* These options set a flag. */
- {"trigger", required_argument, 0, 't'},
- {"sync-after-notif-register", required_argument, 0, 'a'},
+ { "trigger", required_argument, 0, 't' },
+ { "sync-after-notif-register", required_argument, 0, 'a' },
/* Default alue for count is 1 */
- {"count", required_argument, 0, 'b'},
+ { "count", required_argument, 0, 'b' },
/*
* When end-trigger is present the reception loop is exited only when a
* notification matching the end trigger is received.
* Otherwise the loop is exited when the count of notification received
* for `trigger` math the `count` argument.
*/
- {"end-trigger", required_argument, 0, 'c'},
- {0, 0, 0, 0}
+ { "end-trigger", required_argument, 0, 'c' },
+ { 0, 0, 0, 0 }
};
-static bool action_list_contains_notify(
- const struct lttng_action *action_list)
+static bool action_list_contains_notify(const struct lttng_action *action_list)
{
unsigned int i, count;
- enum lttng_action_status status =
- lttng_action_list_get_count(action_list, &count);
+ enum lttng_action_status status = lttng_action_list_get_count(action_list, &count);
if (status != LTTNG_ACTION_STATUS_OK) {
printf("Failed to get action count from action list\n");
}
for (i = 0; i < count; i++) {
- const struct lttng_action *action =
- lttng_action_list_get_at_index(
- action_list, i);
- const enum lttng_action_type action_type =
- lttng_action_get_type(action);
+ const struct lttng_action *action = lttng_action_list_get_at_index(action_list, i);
+ const enum lttng_action_type action_type = lttng_action_get_type(action);
if (action_type == LTTNG_ACTION_TYPE_NOTIFY) {
return true;
/* Only expects named triggers. */
static bool is_trigger_name(const char *expected_trigger_name,
- struct lttng_notification *notification)
+ struct lttng_notification *notification)
{
const char *trigger_name = NULL;
enum lttng_trigger_status trigger_status;
names_match = strcmp(expected_trigger_name, trigger_name) == 0;
if (!names_match) {
- fprintf(stderr, "Got an unexpected trigger name: name = '%s', expected name = '%s'\n",
- trigger_name, expected_trigger_name);
+ fprintf(stderr,
+ "Got an unexpected trigger name: name = '%s', expected name = '%s'\n",
+ trigger_name,
+ expected_trigger_name);
}
end:
return names_match;
struct lttng_notification_channel *notification_channel = NULL;
int expected_notifications = 1, notification_count = 0;
- while ((option = getopt_long(argc, argv, "a:b:c:t:", long_options,
- &option_index)) != -1) {
+ while ((option = getopt_long(argc, argv, "a:b:c:t:", long_options, &option_index)) != -1) {
switch (option) {
case 'a':
after_notif_register_file_path = strdup(optarg);
goto end;
}
-
- notification_channel = lttng_notification_channel_create(
- lttng_session_daemon_notification_endpoint);
+ notification_channel =
+ lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
if (!notification_channel) {
fprintf(stderr, "Failed to create notification channel\n");
ret = -1;
/* Look for the trigger we want to subscribe to. */
for (i = 0; i < count; i++) {
- const struct lttng_trigger *trigger =
- lttng_triggers_get_at_index(triggers, i);
+ const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
const struct lttng_condition *condition =
- lttng_trigger_get_const_condition(trigger);
- const struct lttng_action *action =
- lttng_trigger_get_const_action(trigger);
- const enum lttng_action_type action_type =
- lttng_action_get_type(action);
+ lttng_trigger_get_const_condition(trigger);
+ const struct lttng_action *action = lttng_trigger_get_const_action(trigger);
+ const enum lttng_action_type action_type = lttng_action_get_type(action);
enum lttng_notification_channel_status channel_status;
const char *trigger_name = NULL;
if (strcmp(trigger_name, expected_trigger_name) != 0) {
/* Might match the end event trigger */
if (end_trigger_name != NULL &&
- strcmp(trigger_name,
- end_trigger_name) != 0) {
+ strcmp(trigger_name, end_trigger_name) != 0) {
continue;
}
}
if (!((action_type == LTTNG_ACTION_TYPE_LIST &&
- action_list_contains_notify(action)) ||
- action_type == LTTNG_ACTION_TYPE_NOTIFY)) {
+ action_list_contains_notify(action)) ||
+ action_type == LTTNG_ACTION_TYPE_NOTIFY)) {
/* "The action of trigger is not notify, skipping. */
continue;
}
- channel_status = lttng_notification_channel_subscribe(
- notification_channel, condition);
+ channel_status =
+ lttng_notification_channel_subscribe(notification_channel, condition);
if (channel_status) {
- fprintf(stderr, "Failed to subscribe to notifications of trigger \"%s\"\n",
- trigger_name);
+ fprintf(stderr,
+ "Failed to subscribe to notifications of trigger \"%s\"\n",
+ trigger_name);
ret = -1;
goto end;
}
struct lttng_notification *notification;
enum lttng_notification_channel_status channel_status;
- channel_status =
- lttng_notification_channel_get_next_notification(
- notification_channel,
- ¬ification);
+ channel_status = lttng_notification_channel_get_next_notification(
+ notification_channel, ¬ification);
switch (channel_status) {
case LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED:
printf("Dropped notification\n");
printf("Notification channel was closed by peer.\n");
break;
default:
- fprintf(stderr, "A communication error occurred on the notification channel.\n");
+ fprintf(stderr,
+ "A communication error occurred on the notification channel.\n");
ret = -1;
goto end;
}
/* Early exit check. */
- if (end_trigger_name != NULL &&
- is_trigger_name(end_trigger_name,
- notification)) {
+ if (end_trigger_name != NULL && is_trigger_name(end_trigger_name, notification)) {
/* Exit the loop immediately. */
printf("Received end event notification from trigger %s\n",
- end_trigger_name);
+ end_trigger_name);
lttng_notification_destroy(notification);
goto evaluate_success;
}
goto end;
}
- printf("Received event notification from trigger %s\n",
- expected_trigger_name);
+ printf("Received event notification from trigger %s\n", expected_trigger_name);
notification_count++;
- if (end_trigger_name == NULL &&
- expected_notifications == notification_count) {
+ if (end_trigger_name == NULL && expected_notifications == notification_count) {
/*
* Here the loop exit is controlled by the number of
* notification and not by the reception of the end
/* Success */
ret = 0;
} else {
- fprintf(stderr, "Expected %d notification got %d\n",
- expected_notifications, notification_count);
+ fprintf(stderr,
+ "Expected %d notification got %d\n",
+ expected_notifications,
+ notification_count);
ret = 1;
}
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(
- my_provider,
- my_first_tracepoint,
- TP_ARGS(
- int, my_integer_arg,
- char*, my_string_arg
- ),
- TP_FIELDS(
- ctf_string(my_string_field, my_string_arg)
- ctf_integer(int, my_integer_field, my_integer_arg)
- )
-)
+TRACEPOINT_EVENT(my_provider,
+ my_first_tracepoint,
+ TP_ARGS(int, my_integer_arg, char *, my_string_arg),
+ TP_FIELDS(ctf_string(my_string_field, my_string_arg)
+ ctf_integer(int, my_integer_field, my_integer_arg)))
#endif /* _TP_H */
*
*/
-#include <stdlib.h>
#include <common/compat/time.hpp>
-#include <string.h>
-#include <stdio.h>
+
#include <lttng/lttng-export.h>
#include <lttng/ust-clock.h>
-static
-uint64_t plugin_read64(void)
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static uint64_t plugin_read64(void)
{
/* Freeze time */
return 0;
}
-static
-uint64_t plugin_freq(void)
+static uint64_t plugin_freq(void)
{
- return 1000; /* 1KHz clock (very coarse!) */
+ return 1000; /* 1KHz clock (very coarse!) */
}
-static
-int plugin_uuid(char *uuid)
+static int plugin_uuid(char *uuid)
{
const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
memcpy(uuid, myuuid, LTTNG_UST_UUID_STR_LEN);
return 0;
}
-static
-const char *plugin_name(void)
+static const char *plugin_name(void)
{
return "lttng_test_clock_override";
}
-static
-const char *plugin_description(void)
+static const char *plugin_description(void)
{
return "Freeze time with 1KHz for regression test";
}
ret = lttng_ust_trace_clock_set_read64_cb(plugin_read64);
if (ret) {
- fprintf(stderr, "Error setting clock override read64 callback: %s\n",
+ fprintf(stderr,
+ "Error setting clock override read64 callback: %s\n",
strerror(-ret));
goto error;
}
ret = lttng_ust_trace_clock_set_freq_cb(plugin_freq);
if (ret) {
- fprintf(stderr, "Error setting clock override freq callback: %s\n",
- strerror(-ret));
+ fprintf(stderr, "Error setting clock override freq callback: %s\n", strerror(-ret));
goto error;
}
ret = lttng_ust_trace_clock_set_uuid_cb(plugin_uuid);
if (ret) {
- fprintf(stderr, "Error setting clock override uuid callback: %s\n",
- strerror(-ret));
+ fprintf(stderr, "Error setting clock override uuid callback: %s\n", strerror(-ret));
goto error;
}
ret = lttng_ust_trace_clock_set_name_cb(plugin_name);
if (ret) {
- fprintf(stderr, "Error setting clock override name callback: %s\n",
- strerror(-ret));
+ fprintf(stderr, "Error setting clock override name callback: %s\n", strerror(-ret));
goto error;
}
ret = lttng_ust_trace_clock_set_description_cb(plugin_description);
if (ret) {
- fprintf(stderr, "Error setting clock override description callback: %s\n",
+ fprintf(stderr,
+ "Error setting clock override description callback: %s\n",
strerror(-ret));
goto error;
}
ret = lttng_ust_enable_trace_clock_override();
if (ret) {
- fprintf(stderr, "Error enabling clock override: %s\n",
- strerror(-ret));
+ fprintf(stderr, "Error enabling clock override: %s\n", strerror(-ret));
goto error;
}
*/
#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
#define TRACEPOINT_DEFINE
#define TRACEPOINT_CREATE_PROBES
#define _TRACEPOINT_UST_TESTS_DAEMON_H
#include <lttng/tracepoint.h>
+
#include <sys/types.h>
-TRACEPOINT_EVENT(ust_tests_daemon, before_daemon,
- TP_ARGS(pid_t, pid),
- TP_FIELDS(
- ctf_integer(pid_t, pid, pid)
- )
-)
-
-TRACEPOINT_EVENT(ust_tests_daemon, after_daemon_child,
- TP_ARGS(pid_t, pid),
- TP_FIELDS(
- ctf_integer(pid_t, pid, pid)
- )
-)
-
-TRACEPOINT_EVENT(ust_tests_daemon, after_daemon_parent,
- TP_ARGS(),
- TP_FIELDS()
-)
+TRACEPOINT_EVENT(ust_tests_daemon,
+ before_daemon,
+ TP_ARGS(pid_t, pid),
+ TP_FIELDS(ctf_integer(pid_t, pid, pid)))
+
+TRACEPOINT_EVENT(ust_tests_daemon,
+ after_daemon_child,
+ TP_ARGS(pid_t, pid),
+ TP_FIELDS(ctf_integer(pid_t, pid, pid)))
+
+TRACEPOINT_EVENT(ust_tests_daemon, after_daemon_parent, TP_ARGS(), TP_FIELDS())
#endif /* _TRACEPOINT_UST_TESTS_DAEMON_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_exitfast, message,
- TP_ARGS(char *, text),
- TP_FIELDS(ctf_string(message, text))
-)
+TRACEPOINT_EVENT(ust_tests_exitfast,
+ message,
+ TP_ARGS(char *, text),
+ TP_FIELDS(ctf_string(message, text)))
TRACEPOINT_LOGLEVEL(ust_tests_exitfast, message, TRACE_INFO)
*/
#include <stdio.h>
-#include <unistd.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <stdlib.h>
+#include <unistd.h>
#define TRACEPOINT_DEFINE
#define TRACEPOINT_CREATE_PROBES
#define _TRACEPOINT_UST_TESTS_FORK_H
#include <lttng/tracepoint.h>
+
#include <sys/types.h>
-TRACEPOINT_EVENT(ust_tests_fork, before_fork,
- TP_ARGS(pid_t, pid),
- TP_FIELDS(
- ctf_integer(pid_t, pid, pid)
- )
-)
-
-TRACEPOINT_EVENT(ust_tests_fork, after_fork_child,
- TP_ARGS(pid_t, pid),
- TP_FIELDS(
- ctf_integer(pid_t, pid, pid)
- )
-)
-
-TRACEPOINT_EVENT(ust_tests_fork, after_fork_parent,
- TP_ARGS(pid_t, pid),
- TP_FIELDS(
- ctf_integer(pid_t, pid, pid)
- )
-)
-
-TRACEPOINT_EVENT(ust_tests_fork, after_exec,
- TP_ARGS(pid_t, pid),
- TP_FIELDS(
- ctf_integer(pid_t, pid, pid)
- )
-)
+TRACEPOINT_EVENT(ust_tests_fork,
+ before_fork,
+ TP_ARGS(pid_t, pid),
+ TP_FIELDS(ctf_integer(pid_t, pid, pid)))
+
+TRACEPOINT_EVENT(ust_tests_fork,
+ after_fork_child,
+ TP_ARGS(pid_t, pid),
+ TP_FIELDS(ctf_integer(pid_t, pid, pid)))
+
+TRACEPOINT_EVENT(ust_tests_fork,
+ after_fork_parent,
+ TP_ARGS(pid_t, pid),
+ TP_FIELDS(ctf_integer(pid_t, pid, pid)))
+
+TRACEPOINT_EVENT(ust_tests_fork,
+ after_exec,
+ TP_ARGS(pid_t, pid),
+ TP_FIELDS(ctf_integer(pid_t, pid, pid)))
#endif /* _TRACEPOINT_UST_TESTS_FORK_H */
*
*/
-#include <stdlib.h>
#include <common/compat/time.hpp>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
+
#include <lttng/lttng-export.h>
#include <lttng/ust-getcpu.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
static long nprocessors;
-static
-int plugin_getcpu(void)
+static int plugin_getcpu(void)
{
/* Generate a sequence based on the number of configurated processor
* by using sequence[i] % nb_configured_processors. Where sequence
* plugin but provide a strong argument of it's validity.
*/
static int i = 0;
- static int seq_seed[256] = { 100, 57, 232, 236, 42, 193, 224, 184, 216,
- 150, 92, 91, 108, 118, 55, 243, 65, 101, 209, 0, 147, 36, 29,
- 34, 49, 188, 174, 105, 253, 245, 227, 238, 112, 20, 222, 201,
- 102, 175, 119, 19, 132, 41, 78, 90, 114, 64, 138, 14, 48, 18,
- 162, 85, 204, 124, 133, 73, 172, 106, 241, 126, 28, 104, 111,
- 21, 127, 219, 9, 244, 237, 189, 59, 214, 52, 141, 107, 26, 25,
- 199, 3, 157, 117, 234, 33, 44, 46, 84, 69, 155, 122, 250, 231,
- 86, 239, 76, 190, 120, 1, 94, 206, 8, 148, 159, 167, 215, 164,
- 31, 217, 61, 71, 125, 68, 109, 195, 177, 95, 82, 142, 182, 129,
- 87, 37, 140, 134, 186, 173, 39, 116, 143, 254, 229, 131, 67,
- 121, 192, 240, 15, 221, 30, 242, 185, 80, 170, 135, 51, 187,
- 194, 246, 12, 225, 181, 137, 211, 228, 88, 218, 27, 233, 161,
- 77, 252, 123, 93, 220, 248, 205, 223, 144, 128, 196, 70, 247,
- 210, 178, 203, 154, 24, 169, 149, 163, 35, 7, 151, 103, 197,
- 139, 165, 158, 207, 72, 113, 145, 45, 183, 11, 198, 43, 81, 230,
- 97, 96, 2, 66, 213, 146, 179, 22, 58, 54, 38, 160, 200, 235,
- 226, 156, 56, 208, 249, 32, 176, 168, 110, 191, 79, 152, 115,
- 10, 74, 60, 251, 17, 83, 180, 171, 202, 40, 166, 255, 53, 212,
- 98, 5, 50, 99, 4, 89, 13, 63, 6, 136, 153, 23, 16, 47, 130, 75,
- 62 };
+ static int seq_seed[256] = {
+ 100, 57, 232, 236, 42, 193, 224, 184, 216, 150, 92, 91, 108, 118, 55, 243,
+ 65, 101, 209, 0, 147, 36, 29, 34, 49, 188, 174, 105, 253, 245, 227, 238,
+ 112, 20, 222, 201, 102, 175, 119, 19, 132, 41, 78, 90, 114, 64, 138, 14,
+ 48, 18, 162, 85, 204, 124, 133, 73, 172, 106, 241, 126, 28, 104, 111, 21,
+ 127, 219, 9, 244, 237, 189, 59, 214, 52, 141, 107, 26, 25, 199, 3, 157,
+ 117, 234, 33, 44, 46, 84, 69, 155, 122, 250, 231, 86, 239, 76, 190, 120,
+ 1, 94, 206, 8, 148, 159, 167, 215, 164, 31, 217, 61, 71, 125, 68, 109,
+ 195, 177, 95, 82, 142, 182, 129, 87, 37, 140, 134, 186, 173, 39, 116, 143,
+ 254, 229, 131, 67, 121, 192, 240, 15, 221, 30, 242, 185, 80, 170, 135, 51,
+ 187, 194, 246, 12, 225, 181, 137, 211, 228, 88, 218, 27, 233, 161, 77, 252,
+ 123, 93, 220, 248, 205, 223, 144, 128, 196, 70, 247, 210, 178, 203, 154, 24,
+ 169, 149, 163, 35, 7, 151, 103, 197, 139, 165, 158, 207, 72, 113, 145, 45,
+ 183, 11, 198, 43, 81, 230, 97, 96, 2, 66, 213, 146, 179, 22, 58, 54,
+ 38, 160, 200, 235, 226, 156, 56, 208, 249, 32, 176, 168, 110, 191, 79, 152,
+ 115, 10, 74, 60, 251, 17, 83, 180, 171, 202, 40, 166, 255, 53, 212, 98,
+ 5, 50, 99, 4, 89, 13, 63, 6, 136, 153, 23, 16, 47, 130, 75, 62
+ };
int ret;
ret = seq_seed[i] % nprocessors;
ret = lttng_ust_getcpu_override(plugin_getcpu);
if (ret) {
- fprintf(stderr, "Error enabling getcpu override: %s\n",
- strerror(-ret));
+ fprintf(stderr, "Error enabling getcpu override: %s\n", strerror(-ret));
goto error;
}
return;
*
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <arpa/inet.h>
#include <fcntl.h>
#include <signal.h>
-#include <string.h>
-#include <arpa/inet.h>
+#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#define TRACEPOINT_DEFINE
#include "tp.h"
-static
-void inthandler(int sig __attribute__((unused)))
+static void inthandler(int sig __attribute__((unused)))
{
}
-static
-int init_int_handler(void)
+static int init_int_handler(void)
{
int result;
struct sigaction act;
for (i = 0; i < 1000000; i++) {
netint = htonl(i);
- tracepoint(tp, tptest, i, netint, values, text,
- strlen(text), dbl, flt);
+ tracepoint(tp, tptest, i, netint, values, text, strlen(text), dbl, flt);
}
return 0;
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(tp, tptest,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen, double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
+TRACEPOINT_EVENT(
+ tp,
+ tptest,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
#endif /* _TRACEPOINT_TP_H */
/* This program is used to test malloc instrumentation with libustinstr-malloc.
*/
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#define N_ITER 1000
void *ptrs[N_ITER];
for (i = 0; i < N_ITER; i++) {
- ptrs[i] = malloc(i+1000);
+ ptrs[i] = malloc(i + 1000);
if (!ptrs[i]) {
exit(EXIT_FAILURE);
}
*
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <arpa/inet.h>
#include <fcntl.h>
#include <signal.h>
-#include <string.h>
-#include <arpa/inet.h>
+#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#define TRACEPOINT_DEFINE
tracepoint(ust_tests_demo, starting, 123);
for (i = 0; i < 5; i++) {
netint = htonl(i);
- tracepoint(ust_tests_demo2, loop, i, netint, values,
- text, strlen(text), dbl, flt);
+ tracepoint(ust_tests_demo2, loop, i, netint, values, text, strlen(text), dbl, flt);
}
tracepoint(ust_tests_demo, done, 456);
tracepoint(ust_tests_demo3, done, 42);
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_demo, starting,
- TP_ARGS(int, value),
- TP_FIELDS(
- ctf_integer(int, value, value)
- )
-)
+TRACEPOINT_EVENT(ust_tests_demo,
+ starting,
+ TP_ARGS(int, value),
+ TP_FIELDS(ctf_integer(int, value, value)))
TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT)
-TRACEPOINT_EVENT(ust_tests_demo, done,
- TP_ARGS(int, value),
- TP_FIELDS(
- ctf_integer(int, value, value)
- )
-)
+TRACEPOINT_EVENT(ust_tests_demo,
+ done,
+ TP_ARGS(int, value),
+ TP_FIELDS(ctf_integer(int, value, value)))
TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT)
#endif /* _TRACEPOINT_UST_TESTS_DEMO_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_demo2, loop,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text,
- size_t, textlen)
- ctf_sequence_text(char, seqfield2, text,
- size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
+TRACEPOINT_EVENT(
+ ust_tests_demo2,
+ loop,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, TRACE_WARNING)
#endif /* _TRACEPOINT_UST_TESTS_DEMO2_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_demo3, done,
- TP_ARGS(int, value),
- TP_FIELDS(
- ctf_integer(int, value, value)
- )
-)
+TRACEPOINT_EVENT(ust_tests_demo3,
+ done,
+ TP_ARGS(int, value),
+ TP_FIELDS(ctf_integer(int, value, value)))
TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, TRACE_WARNING)
#endif /* _TRACEPOINT_UST_TESTS_DEMO3_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(tp, slow,
- TP_ARGS(unsigned int, c, const char *, thread_name),
- TP_FIELDS(
- ctf_integer(unsigned int, counter, c)
- ctf_string(th_name, thread_name)
- )
-)
+TRACEPOINT_EVENT(tp,
+ slow,
+ TP_ARGS(unsigned int, c, const char *, thread_name),
+ TP_FIELDS(ctf_integer(unsigned int, counter, c) ctf_string(th_name, thread_name)))
#endif /* _TRACEPOINT_TP_H */
#define TRACEPOINT_DEFINE
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#include "callsites.h"
#include "probes.h"
+#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
-#include <pthread.h>
-
-#include "callsites.h"
#ifndef VALUE
#define VALUE (-1)
{
tracepoint(multi, tp, VALUE);
}
-
*/
#include <dlfcn.h>
+#include <popt.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <popt.h>
#if HAS_CALLSITES
#include "callsites.h"
#endif
}
-static
-void print_list(void)
+static void print_list(void)
{
fprintf(stderr, "Test list (-t X):\n");
- fprintf(stderr, "\t0: dlopen() all libraries pass in arguments and execute "
- "the callsite.\n");
- fprintf(stderr, "\t1: simulate the upgrade of a probe provider using dlopen() and dlclose(). \n");
- fprintf(stderr, "\t2: simulate the upgrade of a library containing the callsites using dlopen() and dlclose(). \n");
+ fprintf(stderr,
+ "\t0: dlopen() all libraries pass in arguments and execute "
+ "the callsite.\n");
+ fprintf(stderr,
+ "\t1: simulate the upgrade of a probe provider using dlopen() and dlclose(). \n");
+ fprintf(stderr,
+ "\t2: simulate the upgrade of a library containing the callsites using dlopen() and dlclose(). \n");
}
#if HAS_CALLSITES
-static
-int dl_open_all(int nb_libraries, char **libraries)
+static int dl_open_all(int nb_libraries, char **libraries)
{
int i, ret = 0;
void **handles;
* Takes 2 paths to libraries, dlopen() the first, trace, dlopen() the second,
* and dlclose the first to simulate the upgrade of a library.
*/
-static
-int upgrade_lib(int nb_libraries, char **libraries)
+static int upgrade_lib(int nb_libraries, char **libraries)
{
int i, ret = 0;
void *handles[2];
* Simulate the upgrade of a library containing a callsite.
* Receives two libraries containing callsites for the same tracepoint.
*/
-static
-int upgrade_callsite(int nb_libraries, char **libraries)
+static int upgrade_callsite(int nb_libraries, char **libraries)
{
int ret = 0;
void *handles[2];
char **libraries = NULL;
poptContext optCon;
struct poptOption optionsTable[] = {
- { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", NULL },
- { "list", 'l', 0, 0, 'l', "List of tests (-t X)", NULL },
- POPT_AUTOHELP
- { NULL, 0, 0, NULL, 0, NULL, NULL }
+ { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", NULL },
+ { "list", 'l', 0, 0, 'l', "List of tests (-t X)", NULL },
+ POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
};
optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
}
while ((c = poptGetNextOpt(optCon)) >= 0) {
- switch(c) {
+ switch (c) {
case 'l':
print_list();
goto error;
libraries[nb_libraries - 1] = (char *) poptGetArg(optCon);
}
- switch(test) {
+ switch (test) {
case 0:
#if HAS_CALLSITES
ret = dl_open_all(nb_libraries, libraries);
#else
- fprintf(stderr, "Test not implemented for configuration "
- "(HAS_CALLSITES=%d)\n", HAS_CALLSITES == 1);
+ fprintf(stderr,
+ "Test not implemented for configuration "
+ "(HAS_CALLSITES=%d)\n",
+ HAS_CALLSITES == 1);
#endif
break;
case 1:
#if HAS_CALLSITES
ret = upgrade_lib(nb_libraries, libraries);
#else
- fprintf(stderr, "Test not implemented for configuration "
- "(HAS_CALLSITES=%d)\n", HAS_CALLSITES == 1);
+ fprintf(stderr,
+ "Test not implemented for configuration "
+ "(HAS_CALLSITES=%d)\n",
+ HAS_CALLSITES == 1);
#endif
break;
case 2:
#if !HAS_CALLSITES
ret = upgrade_callsite(nb_libraries, libraries);
#else
- fprintf(stderr, "Test not implemented for configuration "
- "(HAS_CALLSITES=%d)\n", HAS_CALLSITES == 1);
+ fprintf(stderr,
+ "Test not implemented for configuration "
+ "(HAS_CALLSITES=%d)\n",
+ HAS_CALLSITES == 1);
#endif
break;
default:
#define PROBES_H
#include <lttng/tracepoint.h>
+
#include <stdint.h>
#if defined(ACTIVATE_PROBES_A)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer(uint64_t, arg_long_A, arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_integer(uint64_t, arg_long_A, arg)))
#elif defined(ACTIVATE_PROBES_B)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer(uint64_t, arg_long_B, arg)
- ctf_float(float, arg_float_B, (float) arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_integer(uint64_t, arg_long_B, arg)
+ ctf_float(float, arg_float_B, (float) arg)))
#elif defined(ACTIVATE_PROBES_C)
-TRACEPOINT_ENUM(multi, enum_a,
- TP_ENUM_VALUES(
- ctf_enum_value("FIELD_A", 0)
- ctf_enum_value("FIELD_B", 1)
- ctf_enum_range("RANGE_C", 2, 10)
- )
-)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_enum(multi, enum_a, int16_t, enum_short_C, 0)
- ctf_enum(multi, enum_a, int32_t, enum_int_C, 1)
- ctf_enum(multi, enum_a, uint64_t, enum_long_C, 2)
- )
-)
+TRACEPOINT_ENUM(multi,
+ enum_a,
+ TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1)
+ ctf_enum_range("RANGE_C", 2, 10)))
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int16_t, enum_short_C, 0)
+ ctf_enum(multi, enum_a, int32_t, enum_int_C, 1)
+ ctf_enum(multi, enum_a, uint64_t, enum_long_C, 2)))
#elif defined(ACTIVATE_PROBES_D)
-TRACEPOINT_ENUM(multi, enum_a,
- TP_ENUM_VALUES(
- ctf_enum_value("FIELD_A", 0)
- ctf_enum_value("FIELD_B", 1)
- ctf_enum_range("RANGE_C_PRIME", 2, 10)
- )
-)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_enum(multi, enum_a, int32_t, enum_int_D, 1)
- ctf_enum(multi, enum_a, int16_t, enum_short_D, 0)
- ctf_enum(multi, enum_a, uint64_t, enum_long_D, 2)
- )
-)
+TRACEPOINT_ENUM(multi,
+ enum_a,
+ TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1)
+ ctf_enum_range("RANGE_C_PRIME", 2, 10)))
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int32_t, enum_int_D, 1)
+ ctf_enum(multi, enum_a, int16_t, enum_short_D, 0)
+ ctf_enum(multi, enum_a, uint64_t, enum_long_D, 2)))
#elif defined(ACTIVATE_PROBES_E)
/*
* Here we declare tracepoints really similar to one another but are different.
* This is meant to test tracepoint comparaison code.
*/
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer(uint64_t, arg_long, arg)
- )
-)
+TRACEPOINT_EVENT(multi, tp, TP_ARGS(uint64_t, arg), TP_FIELDS(ctf_integer(uint64_t, arg_long, arg)))
#elif defined(ACTIVATE_PROBES_F)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer(int64_t, arg_long, arg)
- )
-)
+TRACEPOINT_EVENT(multi, tp, TP_ARGS(uint64_t, arg), TP_FIELDS(ctf_integer(int64_t, arg_long, arg)))
#elif defined(ACTIVATE_PROBES_G)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer_hex(int64_t, arg_long, arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_integer_hex(int64_t, arg_long, arg)))
#elif defined(ACTIVATE_PROBES_H)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer_hex(int16_t, arg_long, arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_integer_hex(int16_t, arg_long, arg)))
#elif defined(ACTIVATE_PROBES_I)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_integer_hex(int32_t, arg_long, arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_integer_hex(int32_t, arg_long, arg)))
#elif defined(ACTIVATE_PROBES_J)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_float(float, arg_float, (float) arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_float(float, arg_float, (float) arg)))
#elif defined(ACTIVATE_PROBES_K)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_float(double, arg_float, (double) arg)
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_float(double, arg_float, (double) arg)))
#elif defined(ACTIVATE_PROBES_L)
-TRACEPOINT_ENUM(multi, enum_a,
- TP_ENUM_VALUES(
- ctf_enum_value("FIELD_A", 0)
- ctf_enum_value("FIELD_B", 1)
- ctf_enum_range("RANGE_C", 2, 10)
- )
-)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_enum(multi, enum_a, int32_t, enum_int, 1)
- )
-)
+TRACEPOINT_ENUM(multi,
+ enum_a,
+ TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1)
+ ctf_enum_range("RANGE_C", 2, 10)))
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int32_t, enum_int, 1)))
#elif defined(ACTIVATE_PROBES_M)
-TRACEPOINT_ENUM(multi, enum_a,
- TP_ENUM_VALUES(
- ctf_enum_value("FIELD_A", 0)
- ctf_enum_value("FIELD_B", 1)
- ctf_enum_range("RANGE_C", 2, 10)
- )
-)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_enum(multi, enum_a, int64_t, enum_int, 1)
- )
-)
+TRACEPOINT_ENUM(multi,
+ enum_a,
+ TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1)
+ ctf_enum_range("RANGE_C", 2, 10)))
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int64_t, enum_int, 1)))
#elif defined(ACTIVATE_PROBES_N)
-TRACEPOINT_ENUM(multi, enum_a,
- TP_ENUM_VALUES(
- ctf_enum_value("FIELD_A", 0)
- ctf_enum_value("FIELD_B", 1)
- ctf_enum_range("RANGE_C", 2, 10)
- )
-)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_enum(multi, enum_a, int16_t, enum_int, 1)
- )
-)
+TRACEPOINT_ENUM(multi,
+ enum_a,
+ TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1)
+ ctf_enum_range("RANGE_C", 2, 10)))
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int16_t, enum_int, 1)))
#elif defined(ACTIVATE_PROBES_O)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_string(arg_string, "string")
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_string(arg_string, "string")))
#elif defined(ACTIVATE_PROBES_P)
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- ctf_string(my_arg_string, "string")
- )
-)
+TRACEPOINT_EVENT(multi,
+ tp,
+ TP_ARGS(uint64_t, arg),
+ TP_FIELDS(ctf_unused(arg) ctf_string(my_arg_string, "string")))
#else
-TRACEPOINT_EVENT(multi, tp,
- TP_ARGS(uint64_t, arg),
- TP_FIELDS(
- ctf_unused(arg)
- )
-)
+TRACEPOINT_EVENT(multi, tp, TP_ARGS(uint64_t, arg), TP_FIELDS(ctf_unused(arg)))
#endif
#endif /* PROBES_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_gen_nevents, tptest0,
- TP_ARGS(int, anint, long, value),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer(long, longfield, value)
- )
-)
-
-TRACEPOINT_EVENT(ust_gen_nevents, tptest1,
- TP_ARGS(int, anint, long, value),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer(long, longfield, value)
- )
-)
-
-TRACEPOINT_EVENT(ust_gen_nevents, tptest2,
- TP_ARGS(int, anint, long, value),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer(long, longfield, value)
- )
-)
-
-TRACEPOINT_EVENT(ust_gen_nevents, tptest3,
- TP_ARGS(int, anint, long, value),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer(long, longfield, value)
- )
-)
+TRACEPOINT_EVENT(ust_gen_nevents,
+ tptest0,
+ TP_ARGS(int, anint, long, value),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value)))
+
+TRACEPOINT_EVENT(ust_gen_nevents,
+ tptest1,
+ TP_ARGS(int, anint, long, value),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value)))
+
+TRACEPOINT_EVENT(ust_gen_nevents,
+ tptest2,
+ TP_ARGS(int, anint, long, value),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value)))
+
+TRACEPOINT_EVENT(ust_gen_nevents,
+ tptest3,
+ TP_ARGS(int, anint, long, value),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value)))
#endif /* _TRACEPOINT_UST_GEN_NEVENTS_H */
*
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <arpa/inet.h>
#include <fcntl.h>
#include <signal.h>
-#include <string.h>
-#include <arpa/inet.h>
+#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#define TRACEPOINT_DEFINE
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
tracepoint(ust_tests_demo, starting, 123);
for (i = 0; i < 5; i++) {
netint = htonl(i);
- tracepoint(ust_tests_demo2, loop, i, netint, values,
- text, strlen(text), dbl, flt);
+ tracepoint(ust_tests_demo2, loop, i, netint, values, text, strlen(text), dbl, flt);
}
tracepoint(ust_tests_demo, done, 456);
tracepoint(ust_tests_demo3, done, 42);
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_demo, starting,
- TP_ARGS(int, value),
- TP_FIELDS(
- ctf_integer(int, value, value)
- )
-)
+TRACEPOINT_EVENT(ust_tests_demo,
+ starting,
+ TP_ARGS(int, value),
+ TP_FIELDS(ctf_integer(int, value, value)))
TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT)
/*
* Dummy model information, just for example. TODO: we should check if
* EMF model URI have some standard format we should follow.
*/
-TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, starting,
- "http://example.com/path_to_model?q=ust_tests_demo:starting")
-
-TRACEPOINT_EVENT(ust_tests_demo, done,
- TP_ARGS(int, value),
- TP_FIELDS(
- ctf_integer(int, value, value)
- )
-)
+TRACEPOINT_MODEL_EMF_URI(ust_tests_demo,
+ starting,
+ "http://example.com/path_to_model?q=ust_tests_demo:starting")
+
+TRACEPOINT_EVENT(ust_tests_demo,
+ done,
+ TP_ARGS(int, value),
+ TP_FIELDS(ctf_integer(int, value, value)))
TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT)
-TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, done,
- "http://example.com/path_to_model?q=ust_tests_demo:done")
+TRACEPOINT_MODEL_EMF_URI(ust_tests_demo,
+ done,
+ "http://example.com/path_to_model?q=ust_tests_demo:done")
#endif /* _TRACEPOINT_UST_TESTS_DEMO_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_demo2, loop,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text,
- size_t, textlen)
- ctf_sequence_text(char, seqfield2, text,
- size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
+TRACEPOINT_EVENT(
+ ust_tests_demo2,
+ loop,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, TRACE_WARNING)
#endif /* _TRACEPOINT_UST_TESTS_DEMO2_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_tests_demo3, done,
- TP_ARGS(int, value),
- TP_FIELDS(
- ctf_integer(int, value, value)
- )
-)
+TRACEPOINT_EVENT(ust_tests_demo3,
+ done,
+ TP_ARGS(int, value),
+ TP_FIELDS(ctf_integer(int, value, value)))
TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, TRACE_WARNING)
#endif /* _TRACEPOINT_UST_TESTS_DEMO3_H */
int i;
for (i = 0; i < 2; i++) {
- tracepoint(ust_tests_td, tptest, i % 2, (i+1) % 2, i % 21);
- tracepoint(ust_tests_td, tptest_bis, i % 2);
+ tracepoint(ust_tests_td, tptest, i % 2, (i + 1) % 2, i % 21);
+ tracepoint(ust_tests_td, tptest_bis, i % 2);
}
tracepoint(ust_tests_td, test_auto);
#include <lttng/tracepoint.h>
-TRACEPOINT_ENUM(ust_tests_td, testenum,
- TP_ENUM_VALUES(
- ctf_enum_value("zero", 0)
- ctf_enum_value("one", 1)
- )
-)
+TRACEPOINT_ENUM(ust_tests_td,
+ testenum,
+ TP_ENUM_VALUES(ctf_enum_value("zero", 0) ctf_enum_value("one", 1)))
-TRACEPOINT_ENUM(ust_tests_td, testenum2,
- TP_ENUM_VALUES(
- ctf_enum_value("zero", 0)
- ctf_enum_value("five", 5)
- ctf_enum_range("ten_to_twenty", 10, 20)
- )
-)
+TRACEPOINT_ENUM(ust_tests_td,
+ testenum2,
+ TP_ENUM_VALUES(ctf_enum_value("zero", 0) ctf_enum_value("five", 5)
+ ctf_enum_range("ten_to_twenty", 10, 20)))
-TRACEPOINT_ENUM(ust_tests_td, testenum3,
- TP_ENUM_VALUES(
- ctf_enum_auto("zero")
- ctf_enum_value("two", 2)
- ctf_enum_auto("three")
- ctf_enum_range("ten_to_twenty", 10, 20)
- ctf_enum_auto("twenty_one")
- )
-)
+TRACEPOINT_ENUM(ust_tests_td,
+ testenum3,
+ TP_ENUM_VALUES(ctf_enum_auto("zero") ctf_enum_value("two", 2) ctf_enum_auto("three")
+ ctf_enum_range("ten_to_twenty", 10, 20)
+ ctf_enum_auto("twenty_one")))
/*
* Enumeration field is used twice to make sure the global type declaration
* is entered only once in the metadata file.
*/
-TRACEPOINT_EVENT(ust_tests_td, tptest,
+TRACEPOINT_EVENT(
+ ust_tests_td,
+ tptest,
TP_ARGS(int, enumval, int, enumval2, int, enumval3),
TP_FIELDS(
- ctf_enum(ust_tests_td, testenum, int, enumfield, enumval)
- ctf_enum(ust_tests_td, testenum, long long,
- enumfield_bis, enumval2)
- ctf_enum(ust_tests_td, testenum2, unsigned int,
- enumfield_third, enumval3)
- )
-)
+ ctf_enum(ust_tests_td, testenum, int, enumfield, enumval) ctf_enum(
+ ust_tests_td, testenum, long long, enumfield_bis, enumval2)
+ ctf_enum(ust_tests_td, testenum2, unsigned int, enumfield_third, enumval3)))
/*
* Another tracepoint using the global types to make sure each global type is
* entered only once in the metadata file.
*/
-TRACEPOINT_EVENT(ust_tests_td, tptest_bis,
- TP_ARGS(int, enumval),
- TP_FIELDS(
- ctf_enum(ust_tests_td, testenum, unsigned char,
- enumfield, enumval)
- )
-)
+TRACEPOINT_EVENT(ust_tests_td,
+ tptest_bis,
+ TP_ARGS(int, enumval),
+ TP_FIELDS(ctf_enum(ust_tests_td, testenum, unsigned char, enumfield, enumval)))
/*
* Test autoincrementing enumeration values.
*/
-TRACEPOINT_EVENT(ust_tests_td, test_auto,
- TP_ARGS(void),
- TP_FIELDS(
- ctf_enum(ust_tests_td, testenum3, int, zero, 0)
- ctf_enum(ust_tests_td, testenum3, int, two, 2)
- ctf_enum(ust_tests_td, testenum3, int, three, 3)
- ctf_enum(ust_tests_td, testenum3, int, fifteen, 15)
- ctf_enum(ust_tests_td, testenum3, int, twenty_one, 21)
- )
-)
+TRACEPOINT_EVENT(ust_tests_td,
+ test_auto,
+ TP_ARGS(void),
+ TP_FIELDS(ctf_enum(ust_tests_td, testenum3, int, zero, 0) ctf_enum(
+ ust_tests_td, testenum3, int, two, 2)
+ ctf_enum(ust_tests_td, testenum3, int, three, 3) ctf_enum(
+ ust_tests_td, testenum3, int, fifteen, 15)
+ ctf_enum(ust_tests_td, testenum3, int, twenty_one, 21)))
#endif /* _TRACEPOINT_UST_TESTS_TD_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(
- libbar,
- bar,
- TP_ARGS(void),
- TP_FIELDS()
-)
+TRACEPOINT_EVENT(libbar, bar, TP_ARGS(void), TP_FIELDS())
#endif /* _LIBBAR_TP_H */
LTTNG_EXPORT int bar(void);
-#endif /* _LIBBAR_H */
+#endif /* _LIBBAR_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(
- libfoo,
- foo,
- TP_ARGS(void),
- TP_FIELDS()
-)
+TRACEPOINT_EVENT(libfoo, foo, TP_ARGS(void), TP_FIELDS())
#endif /* _LIBFOO_TP_H */
*
*/
-#include "libfoo.h"
#include "libbar.h"
+#include "libfoo.h"
#define TRACEPOINT_DEFINE
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
LTTNG_EXPORT int foo(void);
-#endif /* _LIBFOO_H */
+#endif /* _LIBFOO_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(
- libzzz,
- zzz,
- TP_ARGS(void),
- TP_FIELDS()
-)
+TRACEPOINT_EVENT(libzzz, zzz, TP_ARGS(void), TP_FIELDS())
#endif /* _LIBZZZ_TP_H */
int zzz(void);
-#endif /* _LIBZZZ_H */
+#endif /* _LIBZZZ_H */
*/
/* _GNU_SOURCE is defined by config.h */
+#include <common/compat/errno.hpp>
+
#include <dlfcn.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
-
-#include <common/compat/errno.hpp>
+#include <unistd.h>
/*
* libfoo has a direct dependency on libbar.
* Copyright (C) 2017 Jérémie Galarneau
*/
+#include "tap.h"
+
+#include <assert.h>
#include <ctype.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <limits.h>
-#include <assert.h>
-
-#include "tap.h"
static int no_plan = 0;
static int skip_all = 0;
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
static pthread_mutex_t M = PTHREAD_MUTEX_INITIALIZER;
-# define LOCK pthread_mutex_lock(&M);
-# define UNLOCK pthread_mutex_unlock(&M);
+#define LOCK pthread_mutex_lock(&M);
+#define UNLOCK pthread_mutex_unlock(&M);
#else
-# define LOCK
-# define UNLOCK
+#define LOCK
+#define UNLOCK
#endif
static void _expected_tests(unsigned int);
static void _cleanup(void);
#ifdef __MINGW32__
-static inline
-void flockfile (FILE * filehandle) {
- return;
+static inline void flockfile(FILE *filehandle)
+{
+ return;
}
-static inline
-void funlockfile(FILE * filehandle) {
- return;
+static inline void funlockfile(FILE *filehandle)
+{
+ return;
}
#endif
* test_name -- the name of the test, may be NULL
* test_comment -- a comment to print afterwards, may be NULL
*/
-unsigned int
-_gen_result(int ok, const char *func, const char *file, unsigned int line,
- const char *test_name, ...)
+unsigned int _gen_result(
+ int ok, const char *func, const char *file, unsigned int line, const char *test_name, ...)
{
va_list ap;
char *local_test_name = NULL;
/* Start by taking the test name and performing any printf()
expansions on it */
- if(test_name != NULL) {
+ if (test_name != NULL) {
va_start(ap, test_name);
if (vasprintf(&local_test_name, test_name, ap) == -1) {
local_test_name = NULL;
/* Make sure the test name contains more than digits
and spaces. Emit an error message and exit if it
does */
- if(local_test_name) {
+ if (local_test_name) {
name_is_digits = 1;
- for(c = local_test_name; *c != '\0'; c++) {
- if(!isdigit((unsigned char) *c) && !isspace((unsigned char) *c)) {
+ for (c = local_test_name; *c != '\0'; c++) {
+ if (!isdigit((unsigned char) *c) && !isspace((unsigned char) *c)) {
name_is_digits = 0;
break;
}
}
- if(name_is_digits) {
- diag(" You named your test '%s'. You shouldn't use numbers for your test names.", local_test_name);
+ if (name_is_digits) {
+ diag(" You named your test '%s'. You shouldn't use numbers for your test names.",
+ local_test_name);
diag(" Very confusing.");
}
}
}
- if(!ok) {
+ if (!ok) {
printf("not ");
failures++;
}
printf("ok %d", test_count);
- if(test_name != NULL) {
+ if (test_name != NULL) {
printf(" - ");
/* Print the test name, escaping any '#' characters it
might contain */
- if(local_test_name != NULL) {
+ if (local_test_name != NULL) {
flockfile(stdout);
- for(c = local_test_name; *c != '\0'; c++) {
- if(*c == '#')
+ for (c = local_test_name; *c != '\0'; c++) {
+ if (*c == '#')
fputc('\\', stdout);
- fputc((int)*c, stdout);
+ fputc((int) *c, stdout);
}
funlockfile(stdout);
- } else { /* vasprintf() failed, use a fixed message */
+ } else { /* vasprintf() failed, use a fixed message */
printf("%s", todo_msg_fixed);
}
}
This is not counted as a failure, so decrement the counter if
the test failed. */
- if(todo) {
+ if (todo) {
printf(" # TODO %s", todo_msg ? todo_msg : todo_msg_fixed);
- if(!ok)
+ if (!ok)
failures--;
}
printf("\n");
- if(!ok) {
- if(getenv("HARNESS_ACTIVE") != NULL)
+ if (!ok) {
+ if (getenv("HARNESS_ACTIVE") != NULL)
fputs("\n", stderr);
diag(" Failed %stest (%s:%s() at line %d)",
- todo ? "(TODO) " : "", file, func, line);
+ todo ? "(TODO) " : "",
+ file,
+ func,
+ line);
}
free(local_test_name);
* Initialise the TAP library. Will only do so once, however many times it's
* called.
*/
-void
-_tap_init(void)
+void _tap_init(void)
{
static int run_once = 0;
- if(!run_once) {
+ if (!run_once) {
atexit(_cleanup);
/* stdout needs to be unbuffered so that the output appears
/*
* Note that there's no plan.
*/
-int
-plan_no_plan(void)
+int plan_no_plan(void)
{
-
LOCK;
_tap_init();
- if(have_plan != 0) {
+ if (have_plan != 0) {
fprintf(stderr, "You tried to plan twice!\n");
test_died = 1;
UNLOCK;
/*
* Note that the plan is to skip all tests
*/
-int
-plan_skip_all(const char *reason)
+int plan_skip_all(const char *reason)
{
-
LOCK;
_tap_init();
printf("1..0");
- if(reason != NULL)
+ if (reason != NULL)
printf(" # Skip %s", reason);
printf("\n");
/*
* Note the number of tests that will be run.
*/
-int
-plan_tests(unsigned int tests)
+int plan_tests(unsigned int tests)
{
-
LOCK;
_tap_init();
- if(have_plan != 0) {
+ if (have_plan != 0) {
fprintf(stderr, "You tried to plan twice!\n");
test_died = 1;
UNLOCK;
exit(255);
}
- if(tests == 0) {
+ if (tests == 0) {
fprintf(stderr, "You said to run 0 tests! You've got to run something.\n");
test_died = 1;
UNLOCK;
return e_tests;
}
-unsigned int
-diag(const char *fmt, ...)
+unsigned int diag(const char *fmt, ...)
{
va_list ap;
return 0;
}
-void
-diag_multiline(const char *val)
+void diag_multiline(const char *val)
{
size_t len, i, line_start_idx = 0;
}
}
-void
-_expected_tests(unsigned int tests)
+void _expected_tests(unsigned int tests)
{
-
printf("1..%d\n", tests);
e_tests = tests;
}
-int
-skip(unsigned int n, const char *fmt, ...)
+int skip(unsigned int n, const char *fmt, ...)
{
va_list ap;
char *skip_msg = NULL;
}
va_end(ap);
- while(n-- > 0) {
+ while (n-- > 0) {
test_count++;
- printf("ok %d # skip %s\n", test_count,
- skip_msg != NULL ?
- skip_msg : "libtap():malloc() failed");
+ printf("ok %d # skip %s\n",
+ test_count,
+ skip_msg != NULL ? skip_msg : "libtap():malloc() failed");
}
free(skip_msg);
return 1;
}
-void
-todo_start(const char *fmt, ...)
+void todo_start(const char *fmt, ...)
{
va_list ap;
UNLOCK;
}
-void
-todo_end(void)
+void todo_end(void)
{
-
LOCK;
todo = 0;
UNLOCK;
}
-int
-exit_status(void)
+int exit_status(void)
{
int r;
LOCK;
/* If there's no plan, just return the number of failures */
- if(no_plan || !have_plan) {
+ if (no_plan || !have_plan) {
UNLOCK;
return failures;
}
/* Ran too many tests? Return the number of tests that were run
that shouldn't have been */
- if(e_tests < test_count) {
+ if (e_tests < test_count) {
r = test_count - e_tests;
UNLOCK;
return r;
* Cleanup at the end of the run, produce any final output that might be
* required.
*/
-void
-_cleanup(void)
+void _cleanup(void)
{
-
LOCK;
/* If plan_no_plan() wasn't called, and we don't have a plan,
and we're not skipping everything, then something happened
before we could produce any output */
- if(!no_plan && !have_plan && !skip_all) {
+ if (!no_plan && !have_plan && !skip_all) {
diag("Looks like your test died before it could output anything.");
UNLOCK;
return;
}
- if(test_died) {
+ if (test_died) {
diag("Looks like your test died just after %d.", test_count);
UNLOCK;
return;
}
-
/* No plan provided, but now we know how many tests were run, and can
print the header at the end */
- if(!skip_all && (no_plan || !have_plan)) {
+ if (!skip_all && (no_plan || !have_plan)) {
printf("1..%d\n", test_count);
}
- if((have_plan && !no_plan) && e_tests < test_count) {
+ if ((have_plan && !no_plan) && e_tests < test_count) {
diag("Looks like you planned %d %s but ran %d extra.",
- e_tests, e_tests == 1 ? "test" : "tests", test_count - e_tests);
+ e_tests,
+ e_tests == 1 ? "test" : "tests",
+ test_count - e_tests);
UNLOCK;
return;
}
- if((have_plan || !no_plan) && e_tests > test_count) {
+ if ((have_plan || !no_plan) && e_tests > test_count) {
diag("Looks like you planned %d %s but only ran %d.",
- e_tests, e_tests == 1 ? "test" : "tests", test_count);
+ e_tests,
+ e_tests == 1 ? "test" : "tests",
+ test_count);
UNLOCK;
return;
}
- if(failures)
+ if (failures)
diag("Looks like you failed %d %s of %d.",
- failures, failures == 1 ? "test" : "tests", test_count);
+ failures,
+ failures == 1 ? "test" : "tests",
+ test_count);
UNLOCK;
}
and requires the caller to add the final comma if they've ommitted
the optional arguments */
#ifdef __GNUC__
-# define ok(e, test, ...) ((e) ? \
- _gen_result(1, __func__, __FILE__, __LINE__, \
- test, ## __VA_ARGS__) : \
- _gen_result(0, __func__, __FILE__, __LINE__, \
- test, ## __VA_ARGS__))
-
-# define ok1(e) ((e) ? \
- _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
- _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
-
-# define pass(test, ...) ok(1, test, ## __VA_ARGS__)
-# define fail(test, ...) ok(0, test, ## __VA_ARGS__)
-
-# define skip_start(test, n, fmt, ...) \
- do { \
- if((test)) { \
- skip(n, fmt, ## __VA_ARGS__); \
- continue; \
+#define ok(e, test, ...) \
+ ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__) : \
+ _gen_result(0, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__))
+
+#define ok1(e) \
+ ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
+ _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
+
+#define pass(test, ...) ok(1, test, ##__VA_ARGS__)
+#define fail(test, ...) ok(0, test, ##__VA_ARGS__)
+
+#define skip_start(test, n, fmt, ...) \
+ do { \
+ if ((test)) { \
+ skip(n, fmt, ##__VA_ARGS__); \
+ continue; \
}
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* __GNUC__ */
-# define ok(e, ...) ((e) ? \
- _gen_result(1, __func__, __FILE__, __LINE__, \
- __VA_ARGS__) : \
- _gen_result(0, __func__, __FILE__, __LINE__, \
- __VA_ARGS__))
-
-# define ok1(e) ((e) ? \
- _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
- _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
-
-# define pass(...) ok(1, __VA_ARGS__)
-# define fail(...) ok(0, __VA_ARGS__)
-
-# define skip_start(test, n, ...) \
- do { \
- if((test)) { \
- skip(n, __VA_ARGS__); \
- continue; \
+#define ok(e, ...) \
+ ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, __VA_ARGS__) : \
+ _gen_result(0, __func__, __FILE__, __LINE__, __VA_ARGS__))
+
+#define ok1(e) \
+ ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
+ _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
+
+#define pass(...) ok(1, __VA_ARGS__)
+#define fail(...) ok(0, __VA_ARGS__)
+
+#define skip_start(test, n, ...) \
+ do { \
+ if ((test)) { \
+ skip(n, __VA_ARGS__); \
+ continue; \
}
#else /* __STDC_VERSION__ */
-# error "Needs gcc or C99 compiler for variadic macros."
+#error "Needs gcc or C99 compiler for variadic macros."
#endif /* __STDC_VERSION__ */
-#define skip_end() } while(0);
+#define skip_end() \
+ } \
+ while (0) \
+ ;
#ifdef __MINGW_PRINTF_FORMAT
-# define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
+#define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
#else
-# define TAP_PRINTF_FORMAT printf
+#define TAP_PRINTF_FORMAT printf
#endif
-__attribute__((format(TAP_PRINTF_FORMAT, 5, 6)))
-unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
+__attribute__((format(TAP_PRINTF_FORMAT, 5, 6))) unsigned int
+_gen_result(int, const char *, const char *, unsigned int, const char *, ...);
int plan_no_plan(void);
-__attribute__((noreturn))
-int plan_skip_all(const char *);
+__attribute__((noreturn)) int plan_skip_all(const char *);
int plan_tests(unsigned int);
-__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
-unsigned int diag(const char *, ...);
+__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) unsigned int diag(const char *, ...);
void diag_multiline(const char *);
-__attribute__((format(TAP_PRINTF_FORMAT, 2, 3)))
-int skip(unsigned int, const char *, ...);
+__attribute__((format(TAP_PRINTF_FORMAT, 2, 3))) int skip(unsigned int, const char *, ...);
-__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
-void todo_start(const char *, ...);
+__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) void todo_start(const char *, ...);
void todo_end(void);
int exit_status(void);
*
*/
+#include "utils.h"
+
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
-#include "utils.h"
-
#define LTTNG_MODULES_FILE "/proc/lttng-test-filter-event"
/*
if (argc != 3) {
fprintf(stderr, "Error: Missing argument\n");
- fprintf(stderr, "USAGE: %s PATH_WAIT_FILE NR_EVENTS\n",
- argv[0]);
+ fprintf(stderr, "USAGE: %s PATH_WAIT_FILE NR_EVENTS\n", argv[0]);
ret = -1;
goto end;
}
*
*/
+#include "utils.h"
+
#include <fcntl.h>
#include <signal.h>
#include <stdbool.h>
#include <sys/types.h>
#include <unistd.h>
-#include "utils.h"
-
/**
* The process waits for the creation of a file passed as argument from an
* external processes to execute a syscall and exiting. This is useful for tests
volatile int val = 0;
long nooptimization my_gettid(void);
-long nooptimization
-my_gettid(void)
+long nooptimization my_gettid(void)
{
- long ret;
+ long ret;
#ifdef __x86_64
- asm volatile
- (
- "syscall"
- : "=a" (ret)
- : "0"(__NR_gettid)
- : "cc", "rcx", "r11", "memory"
- );
+ asm volatile("syscall" : "=a"(ret) : "0"(__NR_gettid) : "cc", "rcx", "r11", "memory");
#elif defined(__i386)
- asm volatile
- (
- "int $0x80"
- : "=a" (ret)
- : "0"(__NR_gettid)
- : "cc", "edi", "esi", "memory"
- );
+ asm volatile("int $0x80" : "=a"(ret) : "0"(__NR_gettid) : "cc", "edi", "esi", "memory");
#else
#error "Userspace callstack test not supported for this architecture."
#endif
- return ret;
+ return ret;
}
int nooptimization fct_c(void);
-int nooptimization
-fct_c(void)
+int nooptimization fct_c(void)
{
return my_gettid();
}
int nooptimization fct_b(void);
-int nooptimization
-fct_b(void)
+int nooptimization fct_b(void)
{
val += fct_c();
return val;
}
int nooptimization fct_a(void);
-int nooptimization
-fct_a(void)
+int nooptimization fct_a(void)
{
val += fct_b();
return val;
#if !defined(_TRACEPOINT_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define _TRACEPOINT_TP_H
-#include <sys/types.h>
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(tp, tptest,
- TP_ARGS(ino_t, ns_ino),
- TP_FIELDS(
- ctf_integer(ino_t, ns_ino, ns_ino)
- )
-)
+#include <sys/types.h>
+
+TRACEPOINT_EVENT(tp, tptest, TP_ARGS(ino_t, ns_ino), TP_FIELDS(ctf_integer(ino_t, ns_ino, ns_ino)))
#endif /* _TRACEPOINT_TP_H */
#define _TRACEPOINT_TP_H
#include <lttng/tracepoint.h>
+
#include <stdint.h>
-TRACEPOINT_ENUM(
- tp, tptest_enum,
- TP_ENUM_VALUES(
- ctf_enum_auto("AUTO: EXPECT 0")
- ctf_enum_value("VALUE: 23", 23)
- ctf_enum_value("VALUE: 27", 27)
- ctf_enum_auto("AUTO: EXPECT 28")
- ctf_enum_range("RANGE: 101 TO 303", 101, 303)
- ctf_enum_auto("AUTO: EXPECT 304")
- ctf_enum_value("VALUE: -1", -1)
- )
-)
+TRACEPOINT_ENUM(tp,
+ tptest_enum,
+ TP_ENUM_VALUES(ctf_enum_auto("AUTO: EXPECT 0") ctf_enum_value("VALUE: 23", 23)
+ ctf_enum_value("VALUE: 27",
+ 27) ctf_enum_auto("AUTO: EXPECT 28")
+ ctf_enum_range("RANGE: 101 TO 303", 101, 303)
+ ctf_enum_auto("AUTO: EXPECT 304")
+ ctf_enum_value("VALUE: -1", -1)))
-TRACEPOINT_EVENT(tp, tptest,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- char *, etext, uint32_t * , net_values,
- double, doublearg, float, floatarg),
+TRACEPOINT_EVENT(
+ tp,
+ tptest,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ char *,
+ etext,
+ uint32_t *,
+ net_values,
+ double,
+ doublearg,
+ float,
+ floatarg),
TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer(int, signedfield, -1)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_array_network(uint32_t, arrfield3, net_values, 3)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_sequence_network(uint32_t, seqfield3, net_values, size_t, 3)
- ctf_sequence(long, seqfield4, values, size_t, 3)
- ctf_string(stringfield, text)
- ctf_string(stringfield2, etext)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- ctf_enum(tp, tptest_enum, int, enum0, 0)
- ctf_enum(tp, tptest_enum, int, enum23, 23)
- ctf_enum(tp, tptest_enum, int, enum27, 27)
- ctf_enum(tp, tptest_enum, int, enum28, 28)
- ctf_enum(tp, tptest_enum, int, enum202, 202)
- ctf_enum(tp, tptest_enum, int, enum304, 304)
- ctf_enum(tp, tptest_enum, int, enumnegative, -1)
- )
-)
+ ctf_integer(int, intfield, anint) ctf_integer_hex(int, intfield2, anint) ctf_integer(
+ long, longfield, anint) ctf_integer(int,
+ signedfield,
+ -1) ctf_integer_network(int,
+ netintfield,
+ netint)
+ ctf_integer_network_hex(int, netintfieldhex, netint) ctf_array(
+ long,
+ arrfield1,
+ values,
+ 3) ctf_array_text(char,
+ arrfield2,
+ text,
+ 10) ctf_array_network(uint32_t,
+ arrfield3,
+ net_values,
+ 3) ctf_sequence(char,
+ seqfield1,
+ text,
+ size_t,
+ textlen)
+ ctf_sequence_text(char,
+ seqfield2,
+ text,
+ size_t,
+ textlen) ctf_sequence_network(uint32_t,
+ seqfield3,
+ net_values,
+ size_t,
+ 3)
+ ctf_sequence(long, seqfield4, values, size_t, 3) ctf_string(
+ stringfield,
+ text) ctf_string(stringfield2,
+ etext) ctf_float(float,
+ floatfield,
+ floatarg)
+ ctf_float(double, doublefield, doublearg) ctf_enum(
+ tp,
+ tptest_enum,
+ int,
+ enum0,
+ 0) ctf_enum(tp,
+ tptest_enum,
+ int,
+ enum23,
+ 23) ctf_enum(tp,
+ tptest_enum,
+ int,
+ enum27,
+ 27)
+ ctf_enum(tp, tptest_enum, int, enum28, 28)
+ ctf_enum(tp,
+ tptest_enum,
+ int,
+ enum202,
+ 202) ctf_enum(tp,
+ tptest_enum,
+ int,
+ enum304,
+ 304)
+ ctf_enum(tp,
+ tptest_enum,
+ int,
+ enumnegative,
+ -1)))
-TRACEPOINT_EVENT(tp, end,
- TP_ARGS(),
- TP_FIELDS(
- )
-)
+TRACEPOINT_EVENT(tp, end, TP_ARGS(), TP_FIELDS())
#endif /* _TRACEPOINT_TP_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(tp, the_string,
- TP_ARGS(
- int, i,
- int, arg_i,
- const char *, str
- ),
- TP_FIELDS(
- ctf_integer(int, i, i)
- ctf_integer(long, arg_i, arg_i)
- ctf_string(str, str)
- )
-)
+TRACEPOINT_EVENT(tp,
+ the_string,
+ TP_ARGS(int, i, int, arg_i, const char *, str),
+ TP_FIELDS(ctf_integer(int, i, i) ctf_integer(long, arg_i, arg_i)
+ ctf_string(str, str)))
#endif /* _TRACEPOINT_TP_H */
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(tp, tptest1,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
-TRACEPOINT_EVENT(tp, tptest2,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
-TRACEPOINT_EVENT(tp, tptest3,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
-TRACEPOINT_EVENT(tp, tptest4,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
-TRACEPOINT_EVENT(tp, tptest5,
- TP_ARGS(int, anint, int, netint, long *, values,
- char *, text, size_t, textlen,
- double, doublearg, float, floatarg),
- TP_FIELDS(
- ctf_integer(int, intfield, anint)
- ctf_integer_hex(int, intfield2, anint)
- ctf_integer(long, longfield, anint)
- ctf_integer_network(int, netintfield, netint)
- ctf_integer_network_hex(int, netintfieldhex, netint)
- ctf_array(long, arrfield1, values, 3)
- ctf_array_text(char, arrfield2, text, 10)
- ctf_sequence(char, seqfield1, text, size_t, textlen)
- ctf_sequence_text(char, seqfield2, text, size_t, textlen)
- ctf_string(stringfield, text)
- ctf_float(float, floatfield, floatarg)
- ctf_float(double, doublefield, doublearg)
- )
-)
+TRACEPOINT_EVENT(
+ tp,
+ tptest1,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
+TRACEPOINT_EVENT(
+ tp,
+ tptest2,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
+TRACEPOINT_EVENT(
+ tp,
+ tptest3,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
+TRACEPOINT_EVENT(
+ tp,
+ tptest4,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
+TRACEPOINT_EVENT(
+ tp,
+ tptest5,
+ TP_ARGS(int,
+ anint,
+ int,
+ netint,
+ long *,
+ values,
+ char *,
+ text,
+ size_t,
+ textlen,
+ double,
+ doublearg,
+ float,
+ floatarg),
+ TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex(
+ int, intfield2, anint) ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex(
+ int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10) ctf_sequence(
+ char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double,
+ doublefield,
+ doublearg)))
#endif /* _TRACEPOINT_TP_H */
static volatile int should_quit;
-static
-void sighandler(int sig)
+static void sighandler(int sig)
{
if (sig == SIGTERM) {
should_quit = 1;
}
}
-static
-int set_signal_handler()
+static int set_signal_handler()
{
int ret;
struct sigaction sa {};
#include "foo.h"
volatile int not_a_function = 0;
-void __attribute__ ((noinline)) test_function(void);
-void __attribute__ ((noinline)) test_function(void)
+void __attribute__((noinline)) test_function(void);
+void __attribute__((noinline)) test_function(void)
{
not_a_function += 1;
}
*
*/
-class test_class
-{
+class test_class {
public:
test_class();
void test_method();
volatile int test_member;
};
-
-
*
*/
-#include <sys/sdt.h>
#include "foobar_provider.h"
-void bar_function() {
+
+#include <sys/sdt.h>
+void bar_function()
+{
FOOBAR_TP_IN_DLOPEN();
}
*
*/
-#include <sys/sdt.h>
#include "foobar_provider.h"
-void foo_function() {
+
+#include <sys/sdt.h>
+void foo_function()
+{
FOOBAR_TP_IN_SHARED_OBJECT();
}
-void overridable_function() {
+void overridable_function()
+{
}
*
*/
-#include <sys/sdt.h>
#include "foobar_provider.h"
-void overridable_function() {
+
+#include <sys/sdt.h>
+void overridable_function()
+{
FOOBAR_TP_IN_LDPRELOAD();
}
*/
#include "foobar_provider.h"
+
#include <sys/sdt.h>
-void sema_function() {
+void sema_function()
+{
FOOBAR_TP_WITH_SEMAPHORE();
}
#define _GNU_SOURCE
#endif
+#include "foobar_provider.h"
+#include "libfoo.h"
+#include "sema.h"
+
#include <dlfcn.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
+#include <sys/sdt.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/sdt.h>
-
-#include "foobar_provider.h"
-#include "libfoo.h"
-#include "sema.h"
-
int main(int argc, char *argv[])
{
void *handle;
fprintf(stderr, "Can't dlopen libbar.so");
return -1;
}
- bar_function = (void (*)())dlsym(handle, "bar_function");
+ bar_function = (void (*)()) dlsym(handle, "bar_function");
bar_function();
dlclose(handle);
sema_function();
return 0;
}
-
extern "C" {
#endif
-#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
+#if !defined(__GLIBC__) || \
+ ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
/*
* Version using XSI strerror_r.
/*
* Version using GNU strerror_r, for linux with appropriate defines.
*/
-#define PERROR_NO_LOGGER(msg, args...) \
- do { \
- char *_perror_buf; \
- char _perror_tmp[200]; \
- _perror_buf = strerror_r( \
- errno, _perror_tmp, sizeof(_perror_tmp)); \
- fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \
+#define PERROR_NO_LOGGER(msg, args...) \
+ do { \
+ char *_perror_buf; \
+ char _perror_tmp[200]; \
+ _perror_buf = strerror_r(errno, _perror_tmp, sizeof(_perror_tmp)); \
+ fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \
} while (0);
#endif