This also removes unused data structure in an unit test.
Signed-off-by: David Goulet <dgoulet@efficios.com>
return NULL;
}
-/*
- * Delete JUL event from given domain. Events hash table MUST be initialized.
- */
-void jul_delete_event(struct jul_event *event, struct jul_domain *dom)
-{
- int ret;
- struct lttng_ht_iter iter;
-
- assert(event);
- assert(dom);
- assert(dom->events);
-
- DBG3("JUL deleting event %s from domain", event->name);
-
- iter.iter.node = &event->node.node;
- rcu_read_lock();
- ret = lttng_ht_del(dom->events, &iter);
- rcu_read_unlock();
- assert(!ret);
-}
-
/*
* Free given JUL event. This event must not be globally visible at this
* point (only expected to be used on failure just after event
error:
return ret;
}
-
-/*
- * Load all lttng kernel modules.
- */
-int modprobe_lttng_all(void)
-{
- int ret;
-
- ret = modprobe_lttng_control();
- if (ret < 0) {
- goto error;
- }
-
- ret = modprobe_lttng_data();
- if (ret < 0) {
- goto error;
- }
-
-error:
- return ret;
-}
void modprobe_remove_lttng_all(void);
void modprobe_remove_lttng_control(void);
void modprobe_remove_lttng_data(void);
-int modprobe_lttng_all(void);
int modprobe_lttng_control(void);
int modprobe_lttng_data(void);
return NULL;
}
-/*
- * Allocate and initialize a ust metadata.
- *
- * Return pointer to structure or NULL.
- */
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
-{
- int ret;
- struct ltt_ust_metadata *lum;
-
- assert(path);
-
- lum = zmalloc(sizeof(struct ltt_ust_metadata));
- if (lum == NULL) {
- PERROR("ust metadata zmalloc");
- goto error;
- }
-
- /* Set default attributes */
- lum->attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
- lum->attr.subbuf_size = default_get_metadata_subbuf_size();
- lum->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
- lum->attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
- lum->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
- lum->attr.output = LTTNG_UST_MMAP;
-
- lum->handle = -1;
- /* Set metadata trace path */
- ret = snprintf(lum->pathname, PATH_MAX, "%s/" DEFAULT_METADATA_NAME, path);
- if (ret < 0) {
- PERROR("asprintf ust metadata");
- goto error_free_metadata;
- }
-
- return lum;
-
-error_free_metadata:
- free(lum);
-error:
- return NULL;
-}
-
/*
* Allocate and initialize an UST context.
*
assert(!ret);
}
-/*
- * Cleanup ust metadata structure.
- */
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
-{
- assert(metadata);
-
- if (!metadata->handle) {
- return;
- }
- DBG2("Trace UST destroy metadata %d", metadata->handle);
- free(metadata);
-}
-
/*
* Iterate over a hash table containing channels and cleanup safely.
*/
uint64_t tracefile_count;
};
-/* UST Metadata */
-struct ltt_ust_metadata {
- int handle;
- struct lttng_ust_object_data *obj;
- char pathname[PATH_MAX]; /* Trace file path name */
- struct lttng_ust_channel_attr attr;
- struct lttng_ust_object_data *stream_obj;
-};
-
/* UST domain global (LTTNG_DOMAIN_UST) */
struct ltt_ust_domain_global {
struct lttng_ht *channels;
struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev,
struct lttng_filter_bytecode *filter,
struct lttng_event_exclusion *exclusion);
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path);
struct ltt_ust_context *trace_ust_create_context(
struct lttng_event_context *ctx);
void trace_ust_delete_channel(struct lttng_ht *ht,
* it's applies.
*/
void trace_ust_destroy_session(struct ltt_ust_session *session);
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata);
void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
void trace_ust_destroy_event(struct ltt_ust_event *event);
{
return NULL;
}
-static inline
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
-{
- return NULL;
-}
-
static inline
void trace_ust_destroy_session(struct ltt_ust_session *session)
{
}
-static inline
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
-{
-}
-
static inline
void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
{
return ret;
}
-/*
- * Return pointer to traceable apps list.
- */
-struct lttng_ht *ust_app_get_ht(void)
-{
- return ust_app_ht;
-}
-
/*
* Return ust app pointer or NULL if not found. RCU read side lock MUST be
* acquired before calling this function.
return;
}
-/*
- * Return traceable_app_count
- */
-unsigned long ust_app_list_count(void)
-{
- unsigned long count;
-
- rcu_read_lock();
- count = lttng_ht_get_count(ust_app_ht);
- rcu_read_unlock();
-
- return count;
-}
-
/*
* Fill events array with all events name of all registered apps.
*/
return ret;
}
-/*
- * For a specific UST session and UST channel, the event for all
- * registered apps.
- */
-int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan)
-{
- int ret = 0;
- struct lttng_ht_iter iter, uiter;
- struct lttng_ht_node_str *ua_chan_node;
- struct ust_app *app;
- struct ust_app_session *ua_sess;
- struct ust_app_channel *ua_chan;
- struct ust_app_event *ua_event;
-
- DBG("UST app disabling all event for all apps in channel "
- "%s for session id %" PRIu64, uchan->name, usess->id);
-
- rcu_read_lock();
-
- /* For all registered applications */
- cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
- if (!app->compatible) {
- /*
- * TODO: In time, we should notice the caller of this error by
- * telling him that this is a version error.
- */
- continue;
- }
- ua_sess = lookup_session_by_app(usess, app);
- if (!ua_sess) {
- /* The application has problem or is probably dead. */
- continue;
- }
-
- /* Lookup channel in the ust app session */
- lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
- ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
- /* If the channel is not found, there is a code flow error */
- assert(ua_chan_node);
-
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
-
- /* Disable each events of channel */
- cds_lfht_for_each_entry(ua_chan->events->ht, &uiter.iter, ua_event,
- node.node) {
- ret = disable_ust_app_event(ua_sess, ua_event, app);
- if (ret < 0) {
- /* XXX: Report error someday... */
- continue;
- }
- }
- }
-
- rcu_read_unlock();
-
- return ret;
-}
-
/*
* For a specific UST session, create the channel for all registered apps.
*/
return ret;
}
-/*
- * Disable event for a channel from a UST session for a specific PID.
- */
-int ust_app_disable_event_pid(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent, pid_t pid)
-{
- int ret = 0;
- struct lttng_ht_iter iter;
- struct lttng_ht_node_str *ua_chan_node, *ua_event_node;
- struct ust_app *app;
- struct ust_app_session *ua_sess;
- struct ust_app_channel *ua_chan;
- struct ust_app_event *ua_event;
-
- DBG("UST app disabling event %s for PID %d", uevent->attr.name, pid);
-
- rcu_read_lock();
-
- app = ust_app_find_by_pid(pid);
- if (app == NULL) {
- ERR("UST app disable event per PID %d not found", pid);
- ret = -1;
- goto error;
- }
-
- if (!app->compatible) {
- ret = 0;
- goto error;
- }
-
- ua_sess = lookup_session_by_app(usess, app);
- if (!ua_sess) {
- /* The application has problem or is probably dead. */
- goto error;
- }
-
- /* Lookup channel in the ust app session */
- lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &iter);
- ua_chan_node = lttng_ht_iter_get_node_str(&iter);
- if (ua_chan_node == NULL) {
- /* Channel does not exist, skip disabling */
- goto error;
- }
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
-
- lttng_ht_lookup(ua_chan->events, (void *)uevent->attr.name, &iter);
- ua_event_node = lttng_ht_iter_get_node_str(&iter);
- if (ua_event_node == NULL) {
- /* Event does not exist, skip disabling */
- goto error;
- }
- ua_event = caa_container_of(ua_event_node, struct ust_app_event, node);
-
- ret = disable_ust_app_event(ua_sess, ua_event, app);
- if (ret < 0) {
- goto error;
- }
-
-error:
- rcu_read_unlock();
- return ret;
-}
-
/*
* Calibrate registered applications.
*/
}
int ust_app_version(struct ust_app *app);
void ust_app_unregister(int sock);
-unsigned long ust_app_list_count(void);
int ust_app_start_trace_all(struct ltt_ust_session *usess);
int ust_app_stop_trace_all(struct ltt_ust_session *usess);
int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
struct ltt_ust_channel *uchan);
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_event_pid(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
- pid_t pid);
int ust_app_enable_event_pid(struct ltt_ust_session *usess,
struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
pid_t pid);
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);
-int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan);
int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
struct ltt_ust_channel *uchan);
int ust_app_disable_event_glb(struct ltt_ust_session *usess,
void ust_app_clean_list(void);
void ust_app_ht_alloc(void);
-struct lttng_ht *ust_app_get_ht(void);
struct ust_app *ust_app_find_by_pid(pid_t pid);
int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate);
struct ust_app_stream *ust_app_alloc_stream(void);
{
}
static inline
-unsigned int ust_app_list_count(void)
-{
- return 0;
-}
-static inline
void ust_app_lock_list(void)
{
}
return NULL;
}
static inline
-struct lttng_ht *ust_app_get_ht(void)
-{
- return NULL;
-}
-static inline
void ust_app_ht_alloc(void)
{}
static inline
return 0;
}
static inline
-int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan)
-{
- return 0;
-}
-static inline
int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
struct ltt_ust_channel *uchan)
{
return 0;
}
static inline
-int ust_app_disable_event_pid(struct ltt_ust_session *usess,
- struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
- pid_t pid)
-{
- return 0;
-}
-static inline
int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate)
{
return 0;
#define RANDOM_STRING_LEN 11
/* Number of TAP tests in this file */
-#define NUM_TESTS 12
+#define NUM_TESTS 10
/* For lttngerr.h */
int lttng_opt_quiet = 1;
trace_ust_destroy_session(usess);
}
-static void test_create_ust_metadata(void)
-{
- struct ltt_ust_metadata *metadata;
-
- assert(usess != NULL);
-
- metadata = trace_ust_create_metadata(PATH1);
- ok(metadata != NULL, "Create UST metadata");
-
- ok(metadata->handle == -1 &&
- strlen(metadata->pathname) &&
- metadata->attr.overwrite
- == DEFAULT_CHANNEL_OVERWRITE &&
- metadata->attr.subbuf_size
- == default_get_metadata_subbuf_size() &&
- metadata->attr.num_subbuf
- == DEFAULT_METADATA_SUBBUF_NUM &&
- metadata->attr.switch_timer_interval
- == DEFAULT_METADATA_SWITCH_TIMER &&
- metadata->attr.read_timer_interval
- == DEFAULT_METADATA_READ_TIMER &&
- metadata->attr.output == LTTNG_UST_MMAP,
- "Validate UST session metadata");
-
- trace_ust_destroy_metadata(metadata);
-}
-
static void test_create_ust_channel(void)
{
struct ltt_ust_channel *uchan;
diag("UST data structures unit test");
test_create_one_ust_session();
- test_create_ust_metadata();
test_create_ust_channel();
test_create_ust_event();
test_create_ust_context();