From b623cb6a788d9e666d9a93658ab04b06458863ef Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 22 Apr 2021 18:46:06 -0400 Subject: [PATCH] Adapt to namespaced liblttng-ust-ctl symbols MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The liblttng-ust ABI bump gave us the opportunity to namespace all public symbols under the 'lttng_ust_' prefix. All of liblttng-ust-ctl public symbols were renamed from 'ustctl_' to 'lttng_ust_ctl_'. Adapt the tools codebase for this API change. Depends-on: lttng-ust: Ic2b9da019e7776b24b98824ae63d16b86c5a5742 Change-Id: I64b61a7fad86a1c0b4734a4a181f6ea7a9de7e24 Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/dispatch.c | 2 +- .../event-notifier-error-accounting.c | 54 +-- src/bin/lttng-sessiond/trace-ust.c | 2 +- src/bin/lttng-sessiond/ust-app.c | 128 +++--- src/bin/lttng-sessiond/ust-app.h | 6 +- src/bin/lttng-sessiond/ust-consumer.c | 8 +- src/bin/lttng-sessiond/ust-ctl-internal.h | 426 +++++++++--------- src/bin/lttng-sessiond/ust-field-utils.c | 130 +++--- src/bin/lttng-sessiond/ust-field-utils.h | 4 +- src/bin/lttng-sessiond/ust-metadata.c | 108 ++--- src/bin/lttng-sessiond/ust-registry.c | 40 +- src/bin/lttng-sessiond/ust-registry.h | 16 +- src/common/consumer/consumer-metadata-cache.h | 2 +- src/common/consumer/consumer-timer.c | 2 +- src/common/consumer/consumer.h | 4 +- src/common/ust-consumer/ust-consumer.c | 140 +++--- src/common/ust-consumer/ust-consumer.h | 8 +- 17 files changed, 540 insertions(+), 540 deletions(-) diff --git a/src/bin/lttng-sessiond/dispatch.c b/src/bin/lttng-sessiond/dispatch.c index 22380fcdd..5777b3b85 100644 --- a/src/bin/lttng-sessiond/dispatch.c +++ b/src/bin/lttng-sessiond/dispatch.c @@ -289,7 +289,7 @@ static void *thread_dispatch_ust_registration(void *data) ust_cmd->sock, ust_cmd->reg_msg.name, ust_cmd->reg_msg.major, ust_cmd->reg_msg.minor); - if (ust_cmd->reg_msg.type == USTCTL_SOCKET_CMD) { + if (ust_cmd->reg_msg.type == LTTNG_UST_CTL_SOCKET_CMD) { wait_node = zmalloc(sizeof(*wait_node)); if (!wait_node) { PERROR("zmalloc wait_node dispatch"); diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.c b/src/bin/lttng-sessiond/event-notifier-error-accounting.c index 70fa39e02..c8d1ae332 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.c +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.c @@ -36,13 +36,13 @@ struct ust_error_accounting_entry { struct urcu_ref ref; struct lttng_ht_node_u64 node; struct rcu_head rcu_head; - struct ustctl_daemon_counter *daemon_counter; + struct lttng_ust_ctl_daemon_counter *daemon_counter; /* * Those `lttng_ust_abi_object_data` are anonymous handles to the * counters objects. * They are only used to be duplicated for each new applications of the * user. To destroy them, call with the `sock` parameter set to -1. - * e.g. `ustctl_release_object(-1, data)`; + * e.g. `lttng_ust_ctl_release_object(-1, data)`; */ struct lttng_ust_abi_object_data *counter; struct lttng_ust_abi_object_data **cpu_counters; @@ -127,16 +127,16 @@ static void free_ust_error_accounting_entry(struct rcu_head *head) caa_container_of(head, typeof(*entry), rcu_head); for (i = 0; i < entry->nr_counter_cpu_fds; i++) { - ustctl_release_object(-1, entry->cpu_counters[i]); + lttng_ust_ctl_release_object(-1, entry->cpu_counters[i]); free(entry->cpu_counters[i]); } free(entry->cpu_counters); - ustctl_release_object(-1, entry->counter); + lttng_ust_ctl_release_object(-1, entry->counter); free(entry->counter); - ustctl_destroy_counter(entry->daemon_counter); + lttng_ust_ctl_destroy_counter(entry->daemon_counter); free(entry); } @@ -372,10 +372,10 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create( struct lttng_ht *uid_ht, const struct ust_app *app) { int i, ret, *cpu_counter_fds = NULL; - struct ustctl_daemon_counter *daemon_counter; + struct lttng_ust_ctl_daemon_counter *daemon_counter; struct lttng_ust_abi_object_data *counter, **cpu_counters; struct ust_error_accounting_entry *entry = NULL; - const struct ustctl_counter_dimension dimension = { + const struct lttng_ust_ctl_counter_dimension dimension = { .size = ust_state.number_indices, .has_underflow = false, .has_overflow = false, @@ -389,7 +389,7 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create( urcu_ref_init(&entry->ref); entry->uid = app->uid; - entry->nr_counter_cpu_fds = ustctl_get_nr_cpu_per_counter(); + entry->nr_counter_cpu_fds = lttng_ust_ctl_get_nr_cpu_per_counter(); cpu_counter_fds = zmalloc(entry->nr_counter_cpu_fds * sizeof(*cpu_counter_fds)); if (!cpu_counter_fds) { @@ -424,17 +424,17 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create( /* * Ownership of the file descriptors transferred to the ustctl object. */ - daemon_counter = ustctl_create_counter(1, &dimension, 0, -1, + daemon_counter = lttng_ust_ctl_create_counter(1, &dimension, 0, -1, entry->nr_counter_cpu_fds, cpu_counter_fds, - USTCTL_COUNTER_BITNESS_32, - USTCTL_COUNTER_ARITHMETIC_MODULAR, - USTCTL_COUNTER_ALLOC_PER_CPU, + LTTNG_UST_CTL_COUNTER_BITNESS_32, + LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR, + LTTNG_UST_CTL_COUNTER_ALLOC_PER_CPU, false); if (!daemon_counter) { goto error_create_daemon_counter; } - ret = ustctl_create_counter_data(daemon_counter, &counter); + ret = lttng_ust_ctl_create_counter_data(daemon_counter, &counter); if (ret) { ERR("Failed to create userspace tracer counter data for application user: uid = %d, pid = %d, application name = '%s'", (int) app->uid, (int) app->pid, app->name); @@ -442,7 +442,7 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create( } for (i = 0; i < entry->nr_counter_cpu_fds; i++) { - ret = ustctl_create_counter_cpu_data(daemon_counter, i, + ret = lttng_ust_ctl_create_counter_cpu_data(daemon_counter, i, &cpu_counters[i]); if (ret) { ERR("Failed to create userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'", @@ -472,14 +472,14 @@ error_create_counter_cpu_data: break; } - ustctl_release_object(-1, cpu_counters[i]); + lttng_ust_ctl_release_object(-1, cpu_counters[i]); free(cpu_counters[i]); } - ustctl_release_object(-1, entry->counter); + lttng_ust_ctl_release_object(-1, entry->counter); free(entry->counter); error_create_counter_data: - ustctl_destroy_counter(daemon_counter); + lttng_ust_ctl_destroy_counter(daemon_counter); error_create_daemon_counter: error_shm_alloc: /* Error occured before per-cpu SHMs were handed-off to ustctl. */ @@ -522,7 +522,7 @@ enum event_notifier_error_accounting_status send_counter_data_to_ust( /* Attach counter to trigger group. */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_send_counter_data_to_ust(app->sock, + ret = lttng_ust_ctl_send_counter_data_to_ust(app->sock, app->event_notifier_group.object->handle, new_counter); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -554,7 +554,7 @@ enum event_notifier_error_accounting_status send_counter_cpu_data_to_ust( enum event_notifier_error_accounting_status status; pthread_mutex_lock(&app->sock_lock); - ret = ustctl_send_counter_cpu_data_to_ust(app->sock, + ret = lttng_ust_ctl_send_counter_cpu_data_to_ust(app->sock, counter, counter_cpu); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -621,7 +621,7 @@ event_notifier_error_accounting_register_app(struct ust_app *app) } /* Duplicate counter object data. */ - ret = ustctl_duplicate_ust_object_data(&new_counter, + ret = lttng_ust_ctl_duplicate_ust_object_data(&new_counter, entry->counter); if (ret) { ERR("Failed to duplicate event notifier error accounting counter for application user: application uid = %d, pid = %d, application name = '%s'", @@ -655,7 +655,7 @@ event_notifier_error_accounting_register_app(struct ust_app *app) for (i = 0; i < entry->nr_counter_cpu_fds; i++) { struct lttng_ust_abi_object_data *new_counter_cpu = NULL; - ret = ustctl_duplicate_ust_object_data(&new_counter_cpu, + ret = lttng_ust_ctl_duplicate_ust_object_data(&new_counter_cpu, entry->cpu_counters[i]); if (ret) { ERR("Failed to duplicate userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'", @@ -702,7 +702,7 @@ error_duplicate_cpu_counter: break; } - ustctl_release_object(-1, cpu_counters[i]); + lttng_ust_ctl_release_object(-1, cpu_counters[i]); free(cpu_counters[i]); } @@ -710,7 +710,7 @@ error_duplicate_cpu_counter: error_allocate_cpu_counters: error_send_counter_data: - ustctl_release_object(-1, new_counter); + lttng_ust_ctl_release_object(-1, new_counter); free(new_counter); error_duplicate_counter: ust_error_accounting_entry_put(entry); @@ -752,14 +752,14 @@ event_notifier_error_accounting_unregister_app(struct ust_app *app) } for (i = 0; i < app->event_notifier_group.nr_counter_cpu; i++) { - ustctl_release_object(app->sock, + lttng_ust_ctl_release_object(app->sock, app->event_notifier_group.counter_cpu[i]); free(app->event_notifier_group.counter_cpu[i]); } free(app->event_notifier_group.counter_cpu); - ustctl_release_object(app->sock, app->event_notifier_group.counter); + lttng_ust_ctl_release_object(app->sock, app->event_notifier_group.counter); free(app->event_notifier_group.counter); status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; @@ -813,7 +813,7 @@ event_notifier_error_accounting_ust_get_count( int64_t local_value = 0; bool overflow = false, underflow = false; - ret = ustctl_counter_aggregate(uid_entry->daemon_counter, + ret = lttng_ust_ctl_counter_aggregate(uid_entry->daemon_counter, dimension_indexes, &local_value, &overflow, &underflow); if (ret || local_value < 0) { @@ -883,7 +883,7 @@ enum event_notifier_error_accounting_status event_notifier_error_accounting_ust_ */ cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) { - const int ret = ustctl_counter_clear(uid_entry->daemon_counter, + const int ret = lttng_ust_ctl_counter_clear(uid_entry->daemon_counter, &dimension_index); if (ret) { diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index b6cf57cf2..5d7d14dca 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -560,7 +560,7 @@ int trace_ust_context_type_event_to_ust( utype = LTTNG_UST_ABI_CONTEXT_IP; break; case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER: - if (!ustctl_has_perf_counters()) { + if (!lttng_ust_ctl_has_perf_counters()) { utype = -1; WARN("Perf counters not implemented in UST"); } else { diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 9f3037f34..d249762a4 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -93,7 +93,7 @@ static uint64_t get_next_session_id(void) } static void copy_channel_attr_to_ustctl( - struct ustctl_consumer_channel_attr *attr, + struct lttng_ust_ctl_consumer_channel_attr *attr, struct lttng_ust_abi_channel_attr *uattr) { /* Copy event attributes since the layout is different. */ @@ -290,7 +290,7 @@ void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx, if (ua_ctx->obj) { pthread_mutex_lock(&app->sock_lock); - ret = ustctl_release_object(sock, ua_ctx->obj); + ret = lttng_ust_ctl_release_object(sock, ua_ctx->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app sock %d release ctx obj handle %d failed with ret %d", @@ -318,7 +318,7 @@ void delete_ust_app_event(int sock, struct ust_app_event *ua_event, free(ua_event->exclusion); if (ua_event->obj != NULL) { pthread_mutex_lock(&app->sock_lock); - ret = ustctl_release_object(sock, ua_event->obj); + ret = lttng_ust_ctl_release_object(sock, ua_event->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app sock %d release event obj failed with ret %d", @@ -359,7 +359,7 @@ static void delete_ust_app_event_notifier_rule(int sock, if (ua_event_notifier_rule->obj != NULL) { pthread_mutex_lock(&app->sock_lock); - ret = ustctl_release_object(sock, ua_event_notifier_rule->obj); + ret = lttng_ust_ctl_release_object(sock, ua_event_notifier_rule->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("Failed to release event notifier object: app = '%s' (ppid %d), ret = %d", @@ -388,7 +388,7 @@ static int release_ust_app_stream(int sock, struct ust_app_stream *stream, if (stream->obj) { pthread_mutex_lock(&app->sock_lock); - ret = ustctl_release_object(sock, stream->obj); + ret = lttng_ust_ctl_release_object(sock, stream->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app sock %d release stream obj failed with ret %d", @@ -564,7 +564,7 @@ void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan, ret = lttng_ht_del(app->ust_objd, &iter); assert(!ret); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_release_object(sock, ua_chan->obj); + ret = lttng_ust_ctl_release_object(sock, ua_chan->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app sock %d release channel obj failed with ret %d", @@ -581,7 +581,7 @@ int ust_app_register_done(struct ust_app *app) int ret; pthread_mutex_lock(&app->sock_lock); - ret = ustctl_register_done(app->sock); + ret = lttng_ust_ctl_register_done(app->sock); pthread_mutex_unlock(&app->sock_lock); return ret; } @@ -596,7 +596,7 @@ int ust_app_release_object(struct ust_app *app, struct lttng_ust_abi_object_data } else { sock = -1; } - ret = ustctl_release_object(sock, data); + ret = lttng_ust_ctl_release_object(sock, data); if (app) { pthread_mutex_unlock(&app->sock_lock); } @@ -929,7 +929,7 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess, if (ua_sess->handle != -1) { pthread_mutex_lock(&app->sock_lock); - ret = ustctl_release_handle(sock, ua_sess->handle); + ret = lttng_ust_ctl_release_handle(sock, ua_sess->handle); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app sock %d release session handle failed with ret %d", @@ -1022,7 +1022,7 @@ void delete_ust_app(struct ust_app *app) ERR("Error unregistering app from event notifier error accounting"); } - ustctl_release_object(sock, app->event_notifier_group.object); + lttng_ust_ctl_release_object(sock, app->event_notifier_group.object); free(app->event_notifier_group.object); } @@ -1165,7 +1165,7 @@ struct ust_app_channel *alloc_ust_app_channel(const char *name, /* Copy attributes */ if (attr) { - /* Translate from lttng_ust_channel to ustctl_consumer_channel_attr. */ + /* Translate from lttng_ust_channel to lttng_ust_ctl_consumer_channel_attr. */ ua_chan->attr.subbuf_size = attr->subbuf_size; ua_chan->attr.num_subbuf = attr->num_subbuf; ua_chan->attr.overwrite = attr->overwrite; @@ -1521,7 +1521,7 @@ int create_ust_channel_context(struct ust_app_channel *ua_chan, health_code_update(); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_add_context(app->sock, &ua_ctx->ctx, + ret = lttng_ust_ctl_add_context(app->sock, &ua_ctx->ctx, ua_chan->obj, &ua_ctx->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -1568,7 +1568,7 @@ static int set_ust_object_filter(struct ust_app *app, goto error; } pthread_mutex_lock(&app->sock_lock); - ret = ustctl_set_filter(app->sock, ust_bytecode, + ret = lttng_ust_ctl_set_filter(app->sock, ust_bytecode, ust_object); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -1622,7 +1622,7 @@ static int set_ust_capture(struct ust_app *app, ust_bytecode->seqnum = capture_seqnum; pthread_mutex_lock(&app->sock_lock); - ret = ustctl_set_capture(app->sock, ust_bytecode, + ret = lttng_ust_ctl_set_capture(app->sock, ust_bytecode, ust_object); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -1692,7 +1692,7 @@ static int set_ust_object_exclusions(struct ust_app *app, goto error; } pthread_mutex_lock(&app->sock_lock); - ret = ustctl_set_exclusion(app->sock, ust_exclusions, ust_object); + ret = lttng_ust_ctl_set_exclusion(app->sock, ust_exclusions, ust_object); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -1729,7 +1729,7 @@ static int disable_ust_object(struct ust_app *app, health_code_update(); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_disable(app->sock, object); + ret = lttng_ust_ctl_disable(app->sock, object); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -1766,7 +1766,7 @@ static int disable_ust_channel(struct ust_app *app, health_code_update(); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_disable(app->sock, ua_chan->obj); + ret = lttng_ust_ctl_disable(app->sock, ua_chan->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -1804,7 +1804,7 @@ static int enable_ust_channel(struct ust_app *app, health_code_update(); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_enable(app->sock, ua_chan->obj); + ret = lttng_ust_ctl_enable(app->sock, ua_chan->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -1844,7 +1844,7 @@ static int enable_ust_object( health_code_update(); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_enable(app->sock, ust_object); + ret = lttng_ust_ctl_enable(app->sock, ust_object); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -1937,7 +1937,7 @@ int create_ust_event(struct ust_app *app, struct ust_app_session *ua_sess, /* Create UST event on tracer */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_create_event(app->sock, &ua_event->attr, ua_chan->obj, + ret = lttng_ust_ctl_create_event(app->sock, &ua_event->attr, ua_chan->obj, &ua_event->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -2129,7 +2129,7 @@ static int create_ust_event_notifier(struct ust_app *app, /* Create UST event notifier against the tracer. */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_create_event_notifier(app->sock, &event_notifier, + ret = lttng_ust_ctl_create_event_notifier(app->sock, &event_notifier, app->event_notifier_group.object, &ua_event_notifier_rule->obj); pthread_mutex_unlock(&app->sock_lock); @@ -2572,7 +2572,7 @@ error: * be NULL. * * Returns 0 on success or else a negative code which is either -ENOMEM or - * -ENOTCONN which is the default code if the ustctl_create_session fails. + * -ENOTCONN which is the default code if the lttng_ust_ctl_create_session fails. */ static int find_or_create_ust_app_session(struct ltt_ust_session *usess, struct ust_app *app, struct ust_app_session **ua_sess_ptr, @@ -2628,7 +2628,7 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess, if (ua_sess->handle == -1) { pthread_mutex_lock(&app->sock_lock); - ret = ustctl_create_session(app->sock); + ret = lttng_ust_ctl_create_session(app->sock); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -3013,7 +3013,7 @@ static int duplicate_stream_object(struct buffer_reg_stream *reg_stream, } /* Duplicate object for stream once the original is in the registry. */ - ret = ustctl_duplicate_ust_object_data(&stream->obj, + ret = lttng_ust_ctl_duplicate_ust_object_data(&stream->obj, reg_stream->obj.ust); if (ret < 0) { ERR("Duplicate stream obj from %p to %p failed with ret %d", @@ -3049,7 +3049,7 @@ static int duplicate_channel_object(struct buffer_reg_channel *buf_reg_chan, } /* Duplicate object for stream once the original is in the registry. */ - ret = ustctl_duplicate_ust_object_data(&ua_chan->obj, buf_reg_chan->obj.ust); + ret = lttng_ust_ctl_duplicate_ust_object_data(&ua_chan->obj, buf_reg_chan->obj.ust); if (ret < 0) { ERR("Duplicate channel obj from %p to %p failed with ret: %d", buf_reg_chan->obj.ust, ua_chan->obj, ret); @@ -3993,7 +3993,7 @@ int ust_app_version(struct ust_app *app) assert(app); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_tracer_version(app->sock, &app->version); + ret = lttng_ust_ctl_tracer_version(app->sock, &app->version); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) { @@ -4027,7 +4027,7 @@ int ust_app_setup_event_notifier_group(struct ust_app *app) app->event_notifier_group.event_pipe); pthread_mutex_lock(&app->sock_lock); - ret = ustctl_create_event_notifier_group(app->sock, + ret = lttng_ust_ctl_create_event_notifier_group(app->sock, event_pipe_write_fd, &event_notifier_group); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { @@ -4096,7 +4096,7 @@ error_accounting: } error: - ustctl_release_object(app->sock, app->event_notifier_group.object); + lttng_ust_ctl_release_object(app->sock, app->event_notifier_group.object); free(app->event_notifier_group.object); app->event_notifier_group.object = NULL; return ret; @@ -4256,7 +4256,7 @@ int ust_app_list_events(struct lttng_event **events) continue; } pthread_mutex_lock(&app->sock_lock); - handle = ustctl_tracepoint_list(app->sock); + handle = lttng_ust_ctl_tracepoint_list(app->sock); if (handle < 0) { if (handle != -EPIPE && handle != -LTTNG_UST_ERR_EXITING) { ERR("UST app list events getting handle failed for app pid %d", @@ -4266,7 +4266,7 @@ int ust_app_list_events(struct lttng_event **events) continue; } - while ((ret = ustctl_tracepoint_list_get(app->sock, handle, + while ((ret = lttng_ust_ctl_tracepoint_list_get(app->sock, handle, &uiter)) != -LTTNG_UST_ERR_NOENT) { /* Handle ustctl error. */ if (ret < 0) { @@ -4285,7 +4285,7 @@ int ust_app_list_events(struct lttng_event **events) break; } free(tmp_event); - release_ret = ustctl_release_handle(app->sock, handle); + release_ret = lttng_ust_ctl_release_handle(app->sock, handle); if (release_ret < 0 && release_ret != -LTTNG_UST_ERR_EXITING && release_ret != -EPIPE) { @@ -4312,7 +4312,7 @@ int ust_app_list_events(struct lttng_event **events) PERROR("realloc ust app events"); free(tmp_event); ret = -ENOMEM; - release_ret = ustctl_release_handle(app->sock, handle); + release_ret = lttng_ust_ctl_release_handle(app->sock, handle); if (release_ret < 0 && release_ret != -LTTNG_UST_ERR_EXITING && release_ret != -EPIPE) { @@ -4334,7 +4334,7 @@ int ust_app_list_events(struct lttng_event **events) tmp_event[count].enabled = -1; count++; } - ret = ustctl_release_handle(app->sock, handle); + ret = lttng_ust_ctl_release_handle(app->sock, handle); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) { ERR("Error releasing app handle for app %d with ret %d", app->sock, ret); @@ -4387,7 +4387,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) continue; } pthread_mutex_lock(&app->sock_lock); - handle = ustctl_tracepoint_field_list(app->sock); + handle = lttng_ust_ctl_tracepoint_field_list(app->sock); if (handle < 0) { if (handle != -EPIPE && handle != -LTTNG_UST_ERR_EXITING) { ERR("UST app list field getting handle failed for app pid %d", @@ -4397,7 +4397,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) continue; } - while ((ret = ustctl_tracepoint_field_list_get(app->sock, handle, + while ((ret = lttng_ust_ctl_tracepoint_field_list_get(app->sock, handle, &uiter)) != -LTTNG_UST_ERR_NOENT) { /* Handle ustctl error. */ if (ret < 0) { @@ -4416,7 +4416,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) break; } free(tmp_event); - release_ret = ustctl_release_handle(app->sock, handle); + release_ret = lttng_ust_ctl_release_handle(app->sock, handle); pthread_mutex_unlock(&app->sock_lock); if (release_ret < 0 && release_ret != -LTTNG_UST_ERR_EXITING && @@ -4443,7 +4443,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) PERROR("realloc ust app event fields"); free(tmp_event); ret = -ENOMEM; - release_ret = ustctl_release_handle(app->sock, handle); + release_ret = lttng_ust_ctl_release_handle(app->sock, handle); pthread_mutex_unlock(&app->sock_lock); if (release_ret && release_ret != -LTTNG_UST_ERR_EXITING && @@ -4471,7 +4471,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) tmp_event[count].event.enabled = -1; count++; } - ret = ustctl_release_handle(app->sock, handle); + ret = lttng_ust_ctl_release_handle(app->sock, handle); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -LTTNG_UST_ERR_EXITING && @@ -5014,7 +5014,7 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) skip_setup: /* This starts the UST tracing */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_start_session(app->sock, ua_sess->handle); + ret = lttng_ust_ctl_start_session(app->sock, ua_sess->handle); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -5043,7 +5043,7 @@ skip_setup: /* Quiescent wait after starting trace */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_wait_quiescent(app->sock); + ret = lttng_ust_ctl_wait_quiescent(app->sock); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app wait quiescent failed for app pid %d ret %d", @@ -5106,7 +5106,7 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app) /* This inhibits UST tracing */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_stop_session(app->sock, ua_sess->handle); + ret = lttng_ust_ctl_stop_session(app->sock, ua_sess->handle); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -5129,7 +5129,7 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app) /* Quiescent wait after stopping trace */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_wait_quiescent(app->sock); + ret = lttng_ust_ctl_wait_quiescent(app->sock); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app wait quiescent failed for app pid %d ret %d", @@ -5479,7 +5479,7 @@ static int destroy_trace(struct ltt_ust_session *usess, struct ust_app *app) /* Quiescent wait after stopping trace */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_wait_quiescent(app->sock); + ret = lttng_ust_ctl_wait_quiescent(app->sock); pthread_mutex_unlock(&app->sock_lock); if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app wait quiescent failed for app pid %d ret %d", @@ -6083,7 +6083,7 @@ int ust_app_recv_registration(int sock, struct ust_register_msg *msg) assert(msg); - ret = ustctl_recv_reg_msg(sock, &msg->type, &msg->major, &msg->minor, + ret = lttng_ust_ctl_recv_reg_msg(sock, &msg->type, &msg->major, &msg->minor, &pid, &ppid, &uid, &gid, &msg->bits_per_long, &msg->uint8_t_alignment, @@ -6183,12 +6183,12 @@ error: * On success 0 is returned else a negative value. */ static int reply_ust_register_channel(int sock, int cobjd, - size_t nr_fields, struct ustctl_field *fields) + size_t nr_fields, struct lttng_ust_ctl_field *fields) { int ret, ret_code = 0; uint32_t chan_id; uint64_t chan_reg_key; - enum ustctl_channel_header type; + enum lttng_ust_ctl_channel_header type; struct ust_app *app; struct ust_app_channel *ua_chan; struct ust_app_session *ua_sess; @@ -6243,7 +6243,7 @@ static int reply_ust_register_channel(int sock, int cobjd, * this channel to better guess header type for per-pid * buffers. */ - type = USTCTL_CHANNEL_HEADER_LARGE; + type = LTTNG_UST_CTL_CHANNEL_HEADER_LARGE; ust_reg_chan->nr_ctx_fields = nr_fields; ust_reg_chan->ctx_fields = fields; fields = NULL; @@ -6269,7 +6269,7 @@ reply: " with id %u, type: %d, ret: %d", chan_reg_key, chan_id, type, ret_code); - ret = ustctl_reply_register_channel(sock, chan_id, type, ret_code); + ret = lttng_ust_ctl_reply_register_channel(sock, chan_id, type, ret_code); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app reply channel failed with ret %d", ret); @@ -6300,7 +6300,7 @@ error_rcu_unlock: * On success 0 is returned else a negative value. */ static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name, - char *sig, size_t nr_fields, struct ustctl_field *fields, + char *sig, size_t nr_fields, struct lttng_ust_ctl_field *fields, int loglevel_value, char *model_emf_uri) { int ret, ret_code; @@ -6366,7 +6366,7 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name, * application can be notified. In case of an error, it's important not to * return a negative error or else the application will get closed. */ - ret = ustctl_reply_register_event(sock, event_id, ret_code); + ret = lttng_ust_ctl_reply_register_event(sock, event_id, ret_code); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app reply event failed with ret %d", ret); @@ -6402,7 +6402,7 @@ error_rcu_unlock: * On success 0 is returned else a negative value. */ static int add_enum_ust_registry(int sock, int sobjd, char *name, - struct ustctl_enum_entry *entries, size_t nr_entries) + struct lttng_ust_ctl_enum_entry *entries, size_t nr_entries) { int ret = 0, ret_code; struct ust_app *app; @@ -6454,7 +6454,7 @@ static int add_enum_ust_registry(int sock, int sobjd, char *name, * application can be notified. In case of an error, it's important not to * return a negative error or else the application will get closed. */ - ret = ustctl_reply_register_enum(sock, enum_id, ret_code); + ret = lttng_ust_ctl_reply_register_enum(sock, enum_id, ret_code); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app reply enum failed with ret %d", ret); @@ -6485,11 +6485,11 @@ error_rcu_unlock: int ust_app_recv_notify(int sock) { int ret; - enum ustctl_notify_cmd cmd; + enum lttng_ust_ctl_notify_cmd cmd; DBG3("UST app receiving notify from sock %d", sock); - ret = ustctl_recv_notify(sock, &cmd); + ret = lttng_ust_ctl_recv_notify(sock, &cmd); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { ERR("UST app recv notify failed with ret %d", ret); @@ -6500,16 +6500,16 @@ int ust_app_recv_notify(int sock) } switch (cmd) { - case USTCTL_NOTIFY_CMD_EVENT: + case LTTNG_UST_CTL_NOTIFY_CMD_EVENT: { int sobjd, cobjd, loglevel_value; char name[LTTNG_UST_ABI_SYM_NAME_LEN], *sig, *model_emf_uri; size_t nr_fields; - struct ustctl_field *fields; + struct lttng_ust_ctl_field *fields; DBG2("UST app ustctl register event received"); - ret = ustctl_recv_register_event(sock, &sobjd, &cobjd, name, + ret = lttng_ust_ctl_recv_register_event(sock, &sobjd, &cobjd, name, &loglevel_value, &sig, &nr_fields, &fields, &model_emf_uri); if (ret < 0) { @@ -6535,15 +6535,15 @@ int ust_app_recv_notify(int sock) break; } - case USTCTL_NOTIFY_CMD_CHANNEL: + case LTTNG_UST_CTL_NOTIFY_CMD_CHANNEL: { int sobjd, cobjd; size_t nr_fields; - struct ustctl_field *fields; + struct lttng_ust_ctl_field *fields; DBG2("UST app ustctl register channel received"); - ret = ustctl_recv_register_channel(sock, &sobjd, &cobjd, &nr_fields, + ret = lttng_ust_ctl_recv_register_channel(sock, &sobjd, &cobjd, &nr_fields, &fields); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -6567,16 +6567,16 @@ int ust_app_recv_notify(int sock) break; } - case USTCTL_NOTIFY_CMD_ENUM: + case LTTNG_UST_CTL_NOTIFY_CMD_ENUM: { int sobjd; char name[LTTNG_UST_ABI_SYM_NAME_LEN]; size_t nr_entries; - struct ustctl_enum_entry *entries; + struct lttng_ust_ctl_enum_entry *entries; DBG2("UST app ustctl register enum received"); - ret = ustctl_recv_register_enum(sock, &sobjd, name, + ret = lttng_ust_ctl_recv_register_enum(sock, &sobjd, name, &entries, &nr_entries); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -7060,7 +7060,7 @@ int ust_app_regenerate_statedump(struct ltt_ust_session *usess, } pthread_mutex_lock(&app->sock_lock); - ret = ustctl_regenerate_statedump(app->sock, ua_sess->handle); + ret = lttng_ust_ctl_regenerate_statedump(app->sock, ua_sess->handle); pthread_mutex_unlock(&app->sock_lock); end_unlock: diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h index 6cdb261ae..e0321cdc4 100644 --- a/src/bin/lttng-sessiond/ust-app.h +++ b/src/bin/lttng-sessiond/ust-app.h @@ -49,7 +49,7 @@ struct ust_app_ht_key { * Application registration data structure. */ struct ust_register_msg { - enum ustctl_socket_type type; + enum lttng_ust_ctl_socket_type type; uint32_t major; uint32_t minor; uint32_t abi_major; @@ -158,7 +158,7 @@ struct ust_app_channel { unsigned int expected_stream_count; char name[LTTNG_UST_ABI_SYM_NAME_LEN]; struct lttng_ust_abi_object_data *obj; - struct ustctl_consumer_channel_attr attr; + struct lttng_ust_ctl_consumer_channel_attr attr; struct ust_app_stream_list streams; /* Session pointer that owns this object. */ struct ust_app_session *session; @@ -237,7 +237,7 @@ struct ust_app_session { unsigned int live_timer_interval; /* usec */ /* Metadata channel attributes. */ - struct ustctl_consumer_channel_attr metadata_attr; + struct lttng_ust_ctl_consumer_channel_attr metadata_attr; char root_shm_path[PATH_MAX]; char shm_path[PATH_MAX]; diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c index cd0a4f21c..14cce9b4f 100644 --- a/src/bin/lttng-sessiond/ust-consumer.c +++ b/src/bin/lttng-sessiond/ust-consumer.c @@ -255,7 +255,7 @@ int ust_consumer_get_channel(struct consumer_socket *socket, } /* First, get the channel from consumer. */ - ret = ustctl_recv_channel_from_consumer(*socket->fd_ptr, &ua_chan->obj); + ret = lttng_ust_ctl_recv_channel_from_consumer(*socket->fd_ptr, &ua_chan->obj); if (ret < 0) { if (ret != -EPIPE) { ERR("Error recv channel from consumer %d with ret %d", @@ -278,7 +278,7 @@ int ust_consumer_get_channel(struct consumer_socket *socket, } /* Stream object is populated by this call if successful. */ - ret = ustctl_recv_stream_from_consumer(*socket->fd_ptr, &stream->obj); + ret = lttng_ust_ctl_recv_stream_from_consumer(*socket->fd_ptr, &stream->obj); if (ret < 0) { free(stream); if (ret == -LTTNG_UST_ERR_NOENT) { @@ -371,7 +371,7 @@ int ust_consumer_send_stream_to_ust(struct ust_app *app, /* Relay stream to application. */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_send_stream_to_ust(app->sock, channel->obj, stream->obj); + ret = lttng_ust_ctl_send_stream_to_ust(app->sock, channel->obj, stream->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { @@ -408,7 +408,7 @@ int ust_consumer_send_channel_to_ust(struct ust_app *app, /* Send stream to application. */ pthread_mutex_lock(&app->sock_lock); - ret = ustctl_send_channel_to_ust(app->sock, ua_sess->handle, channel->obj); + ret = lttng_ust_ctl_send_channel_to_ust(app->sock, ua_sess->handle, channel->obj); pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { diff --git a/src/bin/lttng-sessiond/ust-ctl-internal.h b/src/bin/lttng-sessiond/ust-ctl-internal.h index 77292b002..96cbf79bc 100644 --- a/src/bin/lttng-sessiond/ust-ctl-internal.h +++ b/src/bin/lttng-sessiond/ust-ctl-internal.h @@ -34,7 +34,7 @@ struct lttng_ust_shm_handle; struct lttng_ust_lib_ring_buffer; -struct ustctl_consumer_channel_attr { +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 */ @@ -67,138 +67,138 @@ struct lttng_ust_context_attr { * >= 0: Success (LTTNG_UST_OK) * < 0: error code. */ -int ustctl_register_done(int sock); -int ustctl_create_session(int sock); -int ustctl_create_event(int sock, struct lttng_ust_abi_event *ev, +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 ustctl_add_context(int sock, struct lttng_ust_context_attr *ctx, +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 ustctl_set_filter(int sock, struct lttng_ust_abi_filter_bytecode *bytecode, +int lttng_ust_ctl_set_filter(int sock, struct lttng_ust_abi_filter_bytecode *bytecode, struct lttng_ust_abi_object_data *obj_data); -int ustctl_set_capture(int sock, struct lttng_ust_abi_capture_bytecode *bytecode, +int lttng_ust_ctl_set_capture(int sock, struct lttng_ust_abi_capture_bytecode *bytecode, struct lttng_ust_abi_object_data *obj_data); -int ustctl_set_exclusion(int sock, struct lttng_ust_abi_event_exclusion *exclusion, +int lttng_ust_ctl_set_exclusion(int sock, struct lttng_ust_abi_event_exclusion *exclusion, struct lttng_ust_abi_object_data *obj_data); -int ustctl_enable(int sock, struct lttng_ust_abi_object_data *object); -int ustctl_disable(int sock, struct lttng_ust_abi_object_data *object); -int ustctl_start_session(int sock, int handle); -int ustctl_stop_session(int sock, int handle); +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); +int lttng_ust_ctl_start_session(int sock, int handle); +int lttng_ust_ctl_stop_session(int sock, int handle); /* - * ustctl_create_event notifier_group creates a event notifier group. It + * lttng_ust_ctl_create_event notifier_group creates a event notifier group. It * establishes the connection with the application by providing a file * descriptor of the pipe to be used by the application when a event notifier * of that group is fired. It returns a handle to be used when creating event * notifier in that group. */ -int ustctl_create_event_notifier_group(int sock, int pipe_fd, +int lttng_ust_ctl_create_event_notifier_group(int sock, int pipe_fd, struct lttng_ust_abi_object_data **event_notifier_group); /* - * ustctl_create_event notifier creates a event notifier in a event notifier + * lttng_ust_ctl_create_event notifier creates a event notifier in a event notifier * group giving a event notifier description and a event notifier group handle. * It returns a event notifier handle to be used when enabling the event * notifier, attaching filter, attaching exclusion, and disabling the event * notifier. */ -int ustctl_create_event_notifier(int sock, +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); /* - * ustctl_tracepoint_list returns a tracepoint list handle, or negative + * lttng_ust_ctl_tracepoint_list returns a tracepoint list handle, or negative * error value. */ -int ustctl_tracepoint_list(int sock); +int lttng_ust_ctl_tracepoint_list(int sock); /* - * ustctl_tracepoint_list_get is used to iterate on the tp list + * lttng_ust_ctl_tracepoint_list_get is used to iterate on the tp list * handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is * returned. */ -int ustctl_tracepoint_list_get(int sock, int tp_list_handle, +int lttng_ust_ctl_tracepoint_list_get(int sock, int tp_list_handle, struct lttng_ust_abi_tracepoint_iter *iter); /* - * ustctl_tracepoint_field_list returns a tracepoint field list handle, + * lttng_ust_ctl_tracepoint_field_list returns a tracepoint field list handle, * or negative error value. */ -int ustctl_tracepoint_field_list(int sock); +int lttng_ust_ctl_tracepoint_field_list(int sock); /* - * ustctl_tracepoint_field_list_get is used to iterate on the tp field + * lttng_ust_ctl_tracepoint_field_list_get is used to iterate on the tp field * list handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is * returned. */ -int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle, +int lttng_ust_ctl_tracepoint_field_list_get(int sock, int tp_field_list_handle, struct lttng_ust_abi_field_iter *iter); -int ustctl_tracer_version(int sock, struct lttng_ust_abi_tracer_version *v); -int ustctl_wait_quiescent(int sock); +int lttng_ust_ctl_tracer_version(int sock, struct lttng_ust_abi_tracer_version *v); +int lttng_ust_ctl_wait_quiescent(int sock); -int ustctl_sock_flush_buffer(int sock, struct lttng_ust_abi_object_data *object); +int lttng_ust_ctl_sock_flush_buffer(int sock, struct lttng_ust_abi_object_data *object); -int ustctl_calibrate(int sock, struct lttng_ust_abi_calibrate *calibrate); +int lttng_ust_ctl_calibrate(int sock, struct lttng_ust_abi_calibrate *calibrate); /* Release object created by members of this API. */ -int ustctl_release_object(int sock, struct lttng_ust_abi_object_data *data); +int lttng_ust_ctl_release_object(int sock, struct lttng_ust_abi_object_data *data); /* Release handle returned by create session. */ -int ustctl_release_handle(int sock, int handle); +int lttng_ust_ctl_release_handle(int sock, int handle); -int ustctl_recv_channel_from_consumer(int sock, +int lttng_ust_ctl_recv_channel_from_consumer(int sock, struct lttng_ust_abi_object_data **channel_data); -int ustctl_recv_stream_from_consumer(int sock, +int lttng_ust_ctl_recv_stream_from_consumer(int sock, struct lttng_ust_abi_object_data **stream_data); -int ustctl_send_channel_to_ust(int sock, int session_handle, +int lttng_ust_ctl_send_channel_to_ust(int sock, int session_handle, struct lttng_ust_abi_object_data *channel_data); -int ustctl_send_stream_to_ust(int sock, +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); /* - * ustctl_duplicate_ust_object_data allocated a new object in "dest" if + * lttng_ust_ctl_duplicate_ust_object_data allocated a new object in "dest" if * it succeeds (returns 0). It must be released using - * ustctl_release_object() and then freed with free(). + * lttng_ust_ctl_release_object() and then freed with free(). */ -int ustctl_duplicate_ust_object_data(struct lttng_ust_abi_object_data **dest, +int lttng_ust_ctl_duplicate_ust_object_data(struct lttng_ust_abi_object_data **dest, struct lttng_ust_abi_object_data *src); /* * API used by consumer. */ -struct ustctl_consumer_channel; -struct ustctl_consumer_stream; -struct ustctl_consumer_channel_attr; +struct lttng_ust_ctl_consumer_channel; +struct lttng_ust_ctl_consumer_stream; +struct lttng_ust_ctl_consumer_channel_attr; -int ustctl_get_nr_stream_per_channel(void); +int lttng_ust_ctl_get_nr_stream_per_channel(void); -struct ustctl_consumer_channel * - ustctl_create_channel(struct ustctl_consumer_channel_attr *attr, +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 - * ustctl_destroy_channel(). + * lttng_ust_ctl_destroy_channel(). */ -void ustctl_destroy_channel(struct ustctl_consumer_channel *chan); +void lttng_ust_ctl_destroy_channel(struct lttng_ust_ctl_consumer_channel *chan); -int ustctl_send_channel_to_sessiond(int sock, - struct ustctl_consumer_channel *channel); -int ustctl_channel_close_wait_fd(struct ustctl_consumer_channel *consumer_chan); -int ustctl_channel_close_wakeup_fd(struct ustctl_consumer_channel *consumer_chan); -int ustctl_channel_get_wait_fd(struct ustctl_consumer_channel *consumer_chan); -int ustctl_channel_get_wakeup_fd(struct ustctl_consumer_channel *consumer_chan); +int lttng_ust_ctl_send_channel_to_sessiond(int sock, + 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 ustctl_write_metadata_to_channel( - struct ustctl_consumer_channel *channel, +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 ustctl_write_one_packet_to_channel( - struct ustctl_consumer_channel *channel, +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 */ @@ -206,54 +206,54 @@ ssize_t ustctl_write_one_packet_to_channel( * Send a NULL stream to finish iteration over all streams of a given * channel. */ -int ustctl_send_stream_to_sessiond(int sock, - struct ustctl_consumer_stream *stream); -int ustctl_stream_close_wait_fd(struct ustctl_consumer_stream *stream); -int ustctl_stream_close_wakeup_fd(struct ustctl_consumer_stream *stream); -int ustctl_stream_get_wait_fd(struct ustctl_consumer_stream *stream); -int ustctl_stream_get_wakeup_fd(struct ustctl_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); +int lttng_ust_ctl_stream_get_wakeup_fd(struct lttng_ust_ctl_consumer_stream *stream); /* Create/destroy stream buffers for read */ -struct ustctl_consumer_stream * - ustctl_create_stream(struct ustctl_consumer_channel *channel, +struct lttng_ust_ctl_consumer_stream * + lttng_ust_ctl_create_stream(struct lttng_ust_ctl_consumer_channel *channel, int cpu); -void ustctl_destroy_stream(struct ustctl_consumer_stream *stream); +void lttng_ust_ctl_destroy_stream(struct lttng_ust_ctl_consumer_stream *stream); /* For mmap mode, readable without "get" operation */ -int ustctl_get_mmap_len(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_mmap_len(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len); -int ustctl_get_max_subbuf_size(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_max_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len); /* * For mmap mode, operate on the current packet (between get/put or * get_next/put_next). */ -void *ustctl_get_mmap_base(struct ustctl_consumer_stream *stream); -int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream, +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 ustctl_get_subbuf_size(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len); -int ustctl_get_padded_subbuf_size(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_padded_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len); -int ustctl_get_next_subbuf(struct ustctl_consumer_stream *stream); -int ustctl_put_next_subbuf(struct ustctl_consumer_stream *stream); +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); /* snapshot */ -int ustctl_snapshot(struct ustctl_consumer_stream *stream); -int ustctl_snapshot_sample_positions(struct ustctl_consumer_stream *stream); -int ustctl_snapshot_get_consumed(struct ustctl_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); -int ustctl_snapshot_get_produced(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_snapshot_get_produced(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *pos); -int ustctl_get_subbuf(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_subbuf(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *pos); -int ustctl_put_subbuf(struct ustctl_consumer_stream *stream); +int lttng_ust_ctl_put_subbuf(struct lttng_ust_ctl_consumer_stream *stream); -void ustctl_flush_buffer(struct ustctl_consumer_stream *stream, +void lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream, int producer_active); -void ustctl_clear_buffer(struct ustctl_consumer_stream *stream); +void lttng_ust_ctl_clear_buffer(struct lttng_ust_ctl_consumer_stream *stream); /* index */ @@ -262,17 +262,17 @@ void ustctl_clear_buffer(struct ustctl_consumer_stream *stream); * or get_next/put_next. */ -int ustctl_get_timestamp_begin(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_timestamp_begin(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *timestamp_begin); -int ustctl_get_timestamp_end(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_timestamp_end(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *timestamp_end); -int ustctl_get_events_discarded(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_events_discarded(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *events_discarded); -int ustctl_get_content_size(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_content_size(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *content_size); -int ustctl_get_packet_size(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_packet_size(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *packet_size); -int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_sequence_number(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *seq); /* @@ -280,158 +280,158 @@ int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream, * without "get" operation. */ -int ustctl_get_stream_id(struct ustctl_consumer_stream *stream, +int lttng_ust_ctl_get_stream_id(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *stream_id); -int ustctl_get_instance_id(struct ustctl_consumer_stream *stream, +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 ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream, +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 ustctl_has_perf_counters(void); +int lttng_ust_ctl_has_perf_counters(void); /* Regenerate the statedump. */ -int ustctl_regenerate_statedump(int sock, int handle); +int lttng_ust_ctl_regenerate_statedump(int sock, int handle); /* event registry management */ -enum ustctl_socket_type { - USTCTL_SOCKET_CMD = 0, - USTCTL_SOCKET_NOTIFY = 1, +enum lttng_ust_ctl_socket_type { + LTTNG_UST_CTL_SOCKET_CMD = 0, + LTTNG_UST_CTL_SOCKET_NOTIFY = 1, }; -enum ustctl_notify_cmd { - USTCTL_NOTIFY_CMD_EVENT = 0, - USTCTL_NOTIFY_CMD_CHANNEL = 1, - USTCTL_NOTIFY_CMD_ENUM = 2, +enum lttng_ust_ctl_notify_cmd { + LTTNG_UST_CTL_NOTIFY_CMD_EVENT = 0, + LTTNG_UST_CTL_NOTIFY_CMD_CHANNEL = 1, + LTTNG_UST_CTL_NOTIFY_CMD_ENUM = 2, }; -enum ustctl_channel_header { - USTCTL_CHANNEL_HEADER_UNKNOWN = 0, - USTCTL_CHANNEL_HEADER_COMPACT = 1, - USTCTL_CHANNEL_HEADER_LARGE = 2, +enum lttng_ust_ctl_channel_header { + LTTNG_UST_CTL_CHANNEL_HEADER_UNKNOWN = 0, + LTTNG_UST_CTL_CHANNEL_HEADER_COMPACT = 1, + LTTNG_UST_CTL_CHANNEL_HEADER_LARGE = 2, }; /* event type structures */ -enum ustctl_abstract_types { - ustctl_atype_integer, - ustctl_atype_enum, /* legacy */ - ustctl_atype_array, /* legacy */ - ustctl_atype_sequence, /* legacy */ - ustctl_atype_string, - ustctl_atype_float, - ustctl_atype_variant, /* legacy */ - ustctl_atype_struct, /* legacy */ - ustctl_atype_enum_nestable, - ustctl_atype_array_nestable, - ustctl_atype_sequence_nestable, - ustctl_atype_struct_nestable, - ustctl_atype_variant_nestable, - NR_USTCTL_ABSTRACT_TYPES, +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_string, + lttng_ust_ctl_atype_float, + 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, + lttng_ust_ctl_atype_struct_nestable, + lttng_ust_ctl_atype_variant_nestable, + NR_LTTNG_UST_CTL_ABSTRACT_TYPES, }; -enum ustctl_string_encodings { - ustctl_encode_none = 0, - ustctl_encode_UTF8 = 1, - ustctl_encode_ASCII = 2, - NR_USTCTL_STRING_ENCODINGS, +enum lttng_ust_ctl_string_encodings { + lttng_ust_ctl_encode_none = 0, + lttng_ust_ctl_encode_UTF8 = 1, + lttng_ust_ctl_encode_ASCII = 2, + NR_LTTNG_UST_CTL_STRING_ENCODINGS, }; -#define USTCTL_UST_INTEGER_TYPE_PADDING 24 -struct ustctl_integer_type { +#define LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING 24 +struct lttng_ust_ctl_integer_type { 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 ustctl_string_encodings */ + int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ uint16_t alignment; /* in bits */ - char padding[USTCTL_UST_INTEGER_TYPE_PADDING]; + char padding[LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING]; } LTTNG_PACKED; -#define USTCTL_UST_FLOAT_TYPE_PADDING 24 -struct ustctl_float_type { +#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 reverse_byte_order; uint16_t alignment; /* in bits */ - char padding[USTCTL_UST_FLOAT_TYPE_PADDING]; + char padding[LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING]; } LTTNG_PACKED; -#define USTCTL_UST_ENUM_VALUE_PADDING 15 -struct ustctl_enum_value { +#define LTTNG_UST_CTL_UST_ENUM_VALUE_PADDING 15 +struct lttng_ust_ctl_enum_value { uint64_t value; uint8_t signedness; - char padding[USTCTL_UST_ENUM_VALUE_PADDING]; + char padding[LTTNG_UST_CTL_UST_ENUM_VALUE_PADDING]; } LTTNG_PACKED; -enum ustctl_ust_enum_entry_options { - USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0, +enum lttng_ust_ctl_ust_enum_entry_options { + LTTNG_UST_CTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0, }; -#define USTCTL_UST_ENUM_ENTRY_PADDING 32 -struct ustctl_enum_entry { - struct ustctl_enum_value start, end; /* start and end are inclusive */ +#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]; union { struct { uint32_t options; } LTTNG_PACKED extra; - char padding[USTCTL_UST_ENUM_ENTRY_PADDING]; + char padding[LTTNG_UST_CTL_UST_ENUM_ENTRY_PADDING]; } u; } LTTNG_PACKED; /* legacy */ -#define USTCTL_UST_BASIC_TYPE_PADDING 296 -union _ustctl_basic_type { - struct ustctl_integer_type integer; +#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 ustctl_integer_type container_type; + struct lttng_ust_ctl_integer_type container_type; uint64_t id; /* enum ID in sessiond. */ } enumeration; struct { - int32_t encoding; /* enum ustctl_string_encodings */ + int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ } string; - struct ustctl_float_type _float; - char padding[USTCTL_UST_BASIC_TYPE_PADDING]; + struct lttng_ust_ctl_float_type _float; + char padding[LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING]; } LTTNG_PACKED; /* legacy */ -struct ustctl_basic_type { - enum ustctl_abstract_types atype; +struct lttng_ust_ctl_basic_type { + enum lttng_ust_ctl_abstract_types atype; union { - union _ustctl_basic_type basic; + union _lttng_ust_ctl_basic_type basic; } u; } LTTNG_PACKED; /* * Padding is derived from largest member: u.legacy.sequence which - * contains two basic types, each with USTCTL_UST_BASIC_TYPE_PADDING. + * contains two basic types, each with LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING. */ -#define USTCTL_UST_TYPE_PADDING (2 * USTCTL_UST_BASIC_TYPE_PADDING) -struct ustctl_type { - enum ustctl_abstract_types atype; +#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 ustctl_integer_type integer; - struct ustctl_float_type _float; + struct lttng_ust_ctl_integer_type integer; + struct lttng_ust_ctl_float_type _float; struct { - int32_t encoding; /* enum ustctl_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. */ - /* container_type follows after this struct ustctl_field. */ + /* container_type follows after this struct lttng_ust_ctl_field. */ } enum_nestable; struct { uint32_t length; /* num. elems. */ uint32_t alignment; - /* elem_type follows after this struct ustctl_field. */ + /* elem_type follows after this struct lttng_ust_ctl_field. */ } array_nestable; struct { char length_name[LTTNG_UST_ABI_SYM_NAME_LEN]; @@ -441,45 +441,45 @@ struct ustctl_type { struct { uint32_t nr_fields; uint32_t alignment; - /* Followed by nr_fields struct ustctl_field. */ + /* Followed by nr_fields struct lttng_ust_ctl_field. */ } struct_nestable; struct { uint32_t nr_choices; char tag_name[LTTNG_UST_ABI_SYM_NAME_LEN]; uint32_t alignment; - /* Followed by nr_choices struct ustctl_field. */ + /* Followed by nr_choices struct lttng_ust_ctl_field. */ } variant_nestable; /* Legacy ABI */ union { - union _ustctl_basic_type basic; + union _lttng_ust_ctl_basic_type basic; struct { - struct ustctl_basic_type elem_type; + struct lttng_ust_ctl_basic_type elem_type; uint32_t length; /* num. elems. */ } array; struct { - struct ustctl_basic_type length_type; - struct ustctl_basic_type elem_type; + struct lttng_ust_ctl_basic_type length_type; + struct lttng_ust_ctl_basic_type elem_type; } sequence; struct { uint32_t nr_fields; - /* Followed by nr_fields struct ustctl_field. */ + /* Followed by nr_fields struct lttng_ust_ctl_field. */ } _struct; struct { uint32_t nr_choices; char tag_name[LTTNG_UST_ABI_SYM_NAME_LEN]; - /* Followed by nr_choices struct ustctl_field. */ + /* Followed by nr_choices struct lttng_ust_ctl_field. */ } variant; } legacy; - char padding[USTCTL_UST_TYPE_PADDING]; + char padding[LTTNG_UST_CTL_UST_TYPE_PADDING]; } u; } LTTNG_PACKED; -#define USTCTL_UST_FIELD_PADDING 28 -struct ustctl_field { +#define LTTNG_UST_CTL_UST_FIELD_PADDING 28 +struct lttng_ust_ctl_field { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; - struct ustctl_type type; - char padding[USTCTL_UST_FIELD_PADDING]; + struct lttng_ust_ctl_type type; + char padding[LTTNG_UST_CTL_UST_FIELD_PADDING]; } LTTNG_PACKED; /* @@ -487,8 +487,8 @@ struct ustctl_field { * If an error other than -LTTNG_UST_ERR_UNSUP_MAJOR is returned, * the output fields are not populated. */ -int ustctl_recv_reg_msg(int sock, - enum ustctl_socket_type *type, +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, @@ -507,16 +507,16 @@ int ustctl_recv_reg_msg(int sock, /* * Returns 0 on success, negative UST or system error value on error. * Receive the notification command. The "notify_cmd" can then be used - * by the caller to find out which ustctl_recv_* function should be - * called to receive the notification, and which ustctl_reply_* is + * by the caller to find out which lttng_ust_ctl_recv_* function should be + * called to receive the notification, and which lttng_ust_ctl_reply_* is * appropriate. */ -int ustctl_recv_notify(int sock, enum ustctl_notify_cmd *notify_cmd); +int lttng_ust_ctl_recv_notify(int sock, enum lttng_ust_ctl_notify_cmd *notify_cmd); /* * Returns 0 on success, negative UST or system error value on error. */ -int ustctl_recv_register_event(int sock, +int lttng_ust_ctl_recv_register_event(int sock, int *session_objd, /* session descriptor (output) */ int *channel_objd, /* channel descriptor (output) */ char *event_name, /* @@ -532,74 +532,74 @@ int ustctl_recv_register_event(int sock, * returns success.) */ size_t *nr_fields, - struct ustctl_field **fields, + struct lttng_ust_ctl_field **fields, char **model_emf_uri); /* * Returns 0 on success, negative error value on error. */ -int ustctl_reply_register_event(int sock, +int lttng_ust_ctl_reply_register_event(int sock, 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 ustctl_recv_register_enum(int sock, +int lttng_ust_ctl_recv_register_enum(int sock, int *session_objd, char *enum_name, - struct ustctl_enum_entry **entries, + struct lttng_ust_ctl_enum_entry **entries, size_t *nr_entries); /* * Returns 0 on success, negative error value on error. */ -int ustctl_reply_register_enum(int sock, +int lttng_ust_ctl_reply_register_enum(int sock, uint64_t id, /* enum id (input) */ int ret_code); /* * Returns 0 on success, negative UST or system error value on error. */ -int ustctl_recv_register_channel(int sock, +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 ustctl_field **fields); + struct lttng_ust_ctl_field **fields); /* * Returns 0 on success, negative error value on error. */ -int ustctl_reply_register_channel(int sock, +int lttng_ust_ctl_reply_register_channel(int sock, uint32_t chan_id, - enum ustctl_channel_header header_type, + enum lttng_ust_ctl_channel_header header_type, int ret_code); /* return code. 0 ok, negative error */ /* * Counter API. */ -enum ustctl_counter_bitness { - USTCTL_COUNTER_BITNESS_32 = 0, - USTCTL_COUNTER_BITNESS_64 = 1, +enum lttng_ust_ctl_counter_bitness { + LTTNG_UST_CTL_COUNTER_BITNESS_32 = 0, + LTTNG_UST_CTL_COUNTER_BITNESS_64 = 1, }; -enum ustctl_counter_arithmetic { - USTCTL_COUNTER_ARITHMETIC_MODULAR = 0, - USTCTL_COUNTER_ARITHMETIC_SATURATION = 1, +enum lttng_ust_ctl_counter_arithmetic { + LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR = 0, + LTTNG_UST_CTL_COUNTER_ARITHMETIC_SATURATION = 1, }; /* Used as alloc flags. */ -enum ustctl_counter_alloc { - USTCTL_COUNTER_ALLOC_PER_CPU = (1 << 0), - USTCTL_COUNTER_ALLOC_GLOBAL = (1 << 1), +enum lttng_ust_ctl_counter_alloc { + LTTNG_UST_CTL_COUNTER_ALLOC_PER_CPU = (1 << 0), + LTTNG_UST_CTL_COUNTER_ALLOC_GLOBAL = (1 << 1), }; -struct ustctl_daemon_counter; +struct lttng_ust_ctl_daemon_counter; -int ustctl_get_nr_cpu_per_counter(void); +int lttng_ust_ctl_get_nr_cpu_per_counter(void); -struct ustctl_counter_dimension { +struct lttng_ust_ctl_counter_dimension { uint64_t size; uint64_t underflow_index; uint64_t overflow_index; @@ -607,50 +607,50 @@ struct ustctl_counter_dimension { uint8_t has_overflow; }; -struct ustctl_daemon_counter * - ustctl_create_counter(size_t nr_dimensions, - const struct ustctl_counter_dimension *dimensions, +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 ustctl_counter_bitness bitness, - enum ustctl_counter_arithmetic arithmetic, + enum lttng_ust_ctl_counter_bitness bitness, + enum lttng_ust_ctl_counter_arithmetic arithmetic, uint32_t alloc_flags, bool coalesce_hits); -int ustctl_create_counter_data(struct ustctl_daemon_counter *counter, +int lttng_ust_ctl_create_counter_data(struct lttng_ust_ctl_daemon_counter *counter, struct lttng_ust_abi_object_data **counter_data); -int ustctl_create_counter_global_data(struct ustctl_daemon_counter *counter, +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 ustctl_create_counter_cpu_data(struct ustctl_daemon_counter *counter, int cpu, +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 - * before calling ustctl_destroy_counter(). + * before calling lttng_ust_ctl_destroy_counter(). */ -void ustctl_destroy_counter(struct ustctl_daemon_counter *counter); +void lttng_ust_ctl_destroy_counter(struct lttng_ust_ctl_daemon_counter *counter); -int ustctl_send_counter_data_to_ust(int sock, int parent_handle, +int lttng_ust_ctl_send_counter_data_to_ust(int sock, int parent_handle, struct lttng_ust_abi_object_data *counter_data); -int ustctl_send_counter_global_data_to_ust(int sock, +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 ustctl_send_counter_cpu_data_to_ust(int sock, +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); -int ustctl_counter_read(struct ustctl_daemon_counter *counter, +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); -int ustctl_counter_aggregate(struct ustctl_daemon_counter *counter, +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); -int ustctl_counter_clear(struct ustctl_daemon_counter *counter, +int lttng_ust_ctl_counter_clear(struct lttng_ust_ctl_daemon_counter *counter, const size_t *dimension_indexes); #endif /* LTTNG_UST_CTL_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/ust-field-utils.c b/src/bin/lttng-sessiond/ust-field-utils.c index 9b0ff7a1d..a89fade5e 100644 --- a/src/bin/lttng-sessiond/ust-field-utils.c +++ b/src/bin/lttng-sessiond/ust-field-utils.c @@ -11,24 +11,24 @@ #include "ust-field-utils.h" /* - * The ustctl_field is made of a combination of C basic types - * ustctl_basic_type and _ustctl_basic_type. + * The lttng_ust_ctl_field is made of a combination of C basic types + * lttng_ust_ctl_basic_type and _lttng_ust_ctl_basic_type. * - * ustctl_basic_type contains an enumeration describing the abstract type. - * _ustctl_basic_type does _NOT_ contain an enumeration describing the + * lttng_ust_ctl_basic_type contains an enumeration describing the abstract type. + * _lttng_ust_ctl_basic_type does _NOT_ contain an enumeration describing the * abstract type. * * A layer is needed to use the same code for both structures. - * When dealing with _ustctl_basic_type, we need to use the abstract type of - * the ustctl_type struct. + * When dealing with _lttng_ust_ctl_basic_type, we need to use the abstract type of + * the lttng_ust_ctl_type struct. */ /* - * Compare two ustctl_integer_type fields. + * Compare two lttng_ust_ctl_integer_type fields. * Returns 1 if both are identical. */ -static bool match_ustctl_field_integer(const struct ustctl_integer_type *first, - const struct ustctl_integer_type *second) +static bool match_lttng_ust_ctl_field_integer(const struct lttng_ust_ctl_integer_type *first, + const struct lttng_ust_ctl_integer_type *second) { if (first->size != second->size) { goto no_match; @@ -56,23 +56,23 @@ no_match: } /* - * Compare two _ustctl_basic_type fields known to be of type integer. + * Compare two _lttng_ust_ctl_basic_type fields known to be of type integer. * Returns 1 if both are identical. */ -static bool match_ustctl_field_integer_from_raw_basic_type( - const union _ustctl_basic_type *first, - const union _ustctl_basic_type *second) +static bool match_lttng_ust_ctl_field_integer_from_raw_basic_type( + const union _lttng_ust_ctl_basic_type *first, + const union _lttng_ust_ctl_basic_type *second) { - return match_ustctl_field_integer(&first->integer, &second->integer); + return match_lttng_ust_ctl_field_integer(&first->integer, &second->integer); } /* - * Compare two _ustctl_basic_type fields known to be of type enum. + * Compare two _lttng_ust_ctl_basic_type fields known to be of type enum. * Returns 1 if both are identical. */ -static bool match_ustctl_field_enum_from_raw_basic_type( - const union _ustctl_basic_type *first, - const union _ustctl_basic_type *second) +static bool match_lttng_ust_ctl_field_enum_from_raw_basic_type( + const union _lttng_ust_ctl_basic_type *first, + const union _lttng_ust_ctl_basic_type *second) { /* * Compare enumeration ID. Enumeration ID is provided to the application by @@ -90,7 +90,7 @@ static bool match_ustctl_field_enum_from_raw_basic_type( LTTNG_UST_ABI_SYM_NAME_LEN)) { goto no_match; } - if (!match_ustctl_field_integer(&first->enumeration.container_type, + if (!match_lttng_ust_ctl_field_integer(&first->enumeration.container_type, &second->enumeration.container_type)) { goto no_match; } @@ -102,23 +102,23 @@ no_match: } /* - * Compare two _ustctl_basic_type fields known to be of type string. + * Compare two _lttng_ust_ctl_basic_type fields known to be of type string. * Returns 1 if both are identical. */ -static bool match_ustctl_field_string_from_raw_basic_type( - const union _ustctl_basic_type *first, - const union _ustctl_basic_type *second) +static bool match_lttng_ust_ctl_field_string_from_raw_basic_type( + const union _lttng_ust_ctl_basic_type *first, + const union _lttng_ust_ctl_basic_type *second) { return first->string.encoding == second->string.encoding; } /* - * Compare two _ustctl_basic_type fields known to be of type float. + * Compare two _lttng_ust_ctl_basic_type fields known to be of type float. * Returns 1 if both are identical. */ -static bool match_ustctl_field_float_from_raw_basic_type( - const union _ustctl_basic_type *first, - const union _ustctl_basic_type *second) +static bool match_lttng_ust_ctl_field_float_from_raw_basic_type( + const union _lttng_ust_ctl_basic_type *first, + const union _lttng_ust_ctl_basic_type *second) { if (first->_float.exp_dig != second->_float.exp_dig) { goto no_match; @@ -144,37 +144,37 @@ no_match: } /* - * Compare two _ustctl_basic_type fields given their respective abstract types. + * Compare two _lttng_ust_ctl_basic_type fields given their respective abstract types. * Returns 1 if both are identical. */ -static bool match_ustctl_field_raw_basic_type( - enum ustctl_abstract_types first_atype, - const union _ustctl_basic_type *first, - enum ustctl_abstract_types second_atype, - const union _ustctl_basic_type *second) +static bool match_lttng_ust_ctl_field_raw_basic_type( + enum lttng_ust_ctl_abstract_types first_atype, + const union _lttng_ust_ctl_basic_type *first, + enum lttng_ust_ctl_abstract_types second_atype, + const union _lttng_ust_ctl_basic_type *second) { if (first_atype != second_atype) { goto no_match; } switch (first_atype) { - case ustctl_atype_integer: - if (!match_ustctl_field_integer_from_raw_basic_type(first, second)) { + case lttng_ust_ctl_atype_integer: + if (!match_lttng_ust_ctl_field_integer_from_raw_basic_type(first, second)) { goto no_match; } break; - case ustctl_atype_enum: - if (!match_ustctl_field_enum_from_raw_basic_type(first, second)) { + case lttng_ust_ctl_atype_enum: + if (!match_lttng_ust_ctl_field_enum_from_raw_basic_type(first, second)) { goto no_match; } break; - case ustctl_atype_string: - if (!match_ustctl_field_string_from_raw_basic_type(first, second)) { + case lttng_ust_ctl_atype_string: + if (!match_lttng_ust_ctl_field_string_from_raw_basic_type(first, second)) { goto no_match; } break; - case ustctl_atype_float: - if (!match_ustctl_field_float_from_raw_basic_type(first, second)) { + case lttng_ust_ctl_atype_float: + if (!match_lttng_ust_ctl_field_float_from_raw_basic_type(first, second)) { goto no_match; } break; @@ -189,18 +189,18 @@ no_match: } /* - * Compatibility layer between the ustctl_basic_type struct and - * _ustctl_basic_type union. + * Compatibility layer between the lttng_ust_ctl_basic_type struct and + * _lttng_ust_ctl_basic_type union. */ -static bool match_ustctl_field_basic_type(const struct ustctl_basic_type *first, - const struct ustctl_basic_type *second) +static bool match_lttng_ust_ctl_field_basic_type(const struct lttng_ust_ctl_basic_type *first, + const struct lttng_ust_ctl_basic_type *second) { - return match_ustctl_field_raw_basic_type(first->atype, &first->u.basic, + return match_lttng_ust_ctl_field_raw_basic_type(first->atype, &first->u.basic, second->atype, &second->u.basic); } -int match_ustctl_field(const struct ustctl_field *first, - const struct ustctl_field *second) +int match_lttng_ust_ctl_field(const struct lttng_ust_ctl_field *first, + const struct lttng_ust_ctl_field *second) { /* Check the name of the field is identical. */ if (strncmp(first->name, second->name, LTTNG_UST_ABI_SYM_NAME_LEN)) { @@ -214,32 +214,32 @@ int match_ustctl_field(const struct ustctl_field *first, /* Check the field layout. */ switch (first->type.atype) { - case ustctl_atype_integer: - case ustctl_atype_enum: - case ustctl_atype_string: - case ustctl_atype_float: - if (!match_ustctl_field_raw_basic_type(first->type.atype, + case lttng_ust_ctl_atype_integer: + case lttng_ust_ctl_atype_enum: + case lttng_ust_ctl_atype_string: + case lttng_ust_ctl_atype_float: + if (!match_lttng_ust_ctl_field_raw_basic_type(first->type.atype, &first->type.u.legacy.basic, second->type.atype, &second->type.u.legacy.basic)) { goto no_match; } break; - case ustctl_atype_sequence: + case lttng_ust_ctl_atype_sequence: /* Match element type of the sequence. */ - if (!match_ustctl_field_basic_type(&first->type.u.legacy.sequence.elem_type, + if (!match_lttng_ust_ctl_field_basic_type(&first->type.u.legacy.sequence.elem_type, &second->type.u.legacy.sequence.elem_type)) { goto no_match; } /* Match length type of the sequence. */ - if (!match_ustctl_field_basic_type(&first->type.u.legacy.sequence.length_type, + if (!match_lttng_ust_ctl_field_basic_type(&first->type.u.legacy.sequence.length_type, &second->type.u.legacy.sequence.length_type)) { goto no_match; } break; - case ustctl_atype_array: + case lttng_ust_ctl_atype_array: /* Match element type of the array. */ - if (!match_ustctl_field_basic_type(&first->type.u.legacy.array.elem_type, + if (!match_lttng_ust_ctl_field_basic_type(&first->type.u.legacy.array.elem_type, &second->type.u.legacy.array.elem_type)) { goto no_match; } @@ -249,7 +249,7 @@ int match_ustctl_field(const struct ustctl_field *first, goto no_match; } break; - case ustctl_atype_variant: + case lttng_ust_ctl_atype_variant: /* Compare number of choice of the variants. */ if (first->type.u.legacy.variant.nr_choices != second->type.u.legacy.variant.nr_choices) { @@ -263,13 +263,13 @@ int match_ustctl_field(const struct ustctl_field *first, goto no_match; } break; - case ustctl_atype_struct: + case lttng_ust_ctl_atype_struct: /* Compare number of fields of the structs. */ if (first->type.u.legacy._struct.nr_fields != second->type.u.legacy._struct.nr_fields) { goto no_match; } break; - case ustctl_atype_sequence_nestable: + case lttng_ust_ctl_atype_sequence_nestable: if (first->type.u.sequence_nestable.alignment != second->type.u.sequence_nestable.alignment) { goto no_match; } @@ -281,7 +281,7 @@ int match_ustctl_field(const struct ustctl_field *first, } /* Comparison will be done when marshalling following items. */ break; - case ustctl_atype_array_nestable: + case lttng_ust_ctl_atype_array_nestable: if (first->type.u.array_nestable.alignment != second->type.u.array_nestable.alignment) { goto no_match; } @@ -291,7 +291,7 @@ int match_ustctl_field(const struct ustctl_field *first, } /* Comparison of element type will be done when marshalling following item. */ break; - case ustctl_atype_enum_nestable: + case lttng_ust_ctl_atype_enum_nestable: if (first->type.u.enum_nestable.id != second->type.u.enum_nestable.id) { goto no_match; } @@ -303,7 +303,7 @@ int match_ustctl_field(const struct ustctl_field *first, } /* Comparison of element type will be done when marshalling following item. */ break; - case ustctl_atype_struct_nestable: + case lttng_ust_ctl_atype_struct_nestable: if (first->type.u.struct_nestable.alignment != second->type.u.struct_nestable.alignment) { goto no_match; } @@ -312,7 +312,7 @@ int match_ustctl_field(const struct ustctl_field *first, goto no_match; } break; - case ustctl_atype_variant_nestable: + case lttng_ust_ctl_atype_variant_nestable: if (first->type.u.variant_nestable.alignment != second->type.u.variant_nestable.alignment) { goto no_match; } diff --git a/src/bin/lttng-sessiond/ust-field-utils.h b/src/bin/lttng-sessiond/ust-field-utils.h index 286111f08..ea629d5d5 100644 --- a/src/bin/lttng-sessiond/ust-field-utils.h +++ b/src/bin/lttng-sessiond/ust-field-utils.h @@ -14,7 +14,7 @@ * Compare two UST fields. * Return 1 if both fields have identical definition, 0 otherwise. */ -int match_ustctl_field(const struct ustctl_field *first, - const struct ustctl_field *second); +int match_lttng_ust_ctl_field(const struct lttng_ust_ctl_field *first, + const struct lttng_ust_ctl_field *second); #endif /* LTTNG_UST_FIELD_UTILS_H */ diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c index 86dcc0182..6c807ccee 100644 --- a/src/bin/lttng-sessiond/ust-metadata.c +++ b/src/bin/lttng-sessiond/ust-metadata.c @@ -33,7 +33,7 @@ struct offset_sample { static int _lttng_field_statedump(struct ust_registry_session *session, - const struct ustctl_field *fields, size_t nr_fields, + const struct lttng_ust_ctl_field *fields, size_t nr_fields, size_t *iter_field, size_t nesting); static inline @@ -218,11 +218,11 @@ static int ust_metadata_enum_statedump(struct ust_registry_session *session, const char *enum_name, uint64_t enum_id, - const struct ustctl_integer_type *container_type, + const struct lttng_ust_ctl_integer_type *container_type, const char *field_name, size_t *iter_field, size_t nesting) { struct ust_registry_enum *reg_enum; - const struct ustctl_enum_entry *entries; + const struct lttng_ust_ctl_enum_entry *entries; size_t nr_entries; int ret = 0; size_t i; @@ -248,9 +248,9 @@ int ust_metadata_enum_statedump(struct ust_registry_session *session, container_type->size, container_type->alignment, container_type->signedness, - (container_type->encoding == ustctl_encode_none) + (container_type->encoding == lttng_ust_ctl_encode_none) ? "none" - : (container_type->encoding == ustctl_encode_UTF8) + : (container_type->encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII", container_type->base); @@ -260,7 +260,7 @@ int ust_metadata_enum_statedump(struct ust_registry_session *session, nesting++; /* Dump all entries */ for (i = 0; i < nr_entries; i++) { - const struct ustctl_enum_entry *entry = &entries[i]; + const struct lttng_ust_ctl_enum_entry *entry = &entries[i]; int j, len; ret = print_tabs(session, nesting); @@ -301,7 +301,7 @@ int ust_metadata_enum_statedump(struct ust_registry_session *session, } if (entry->u.extra.options & - USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO) { + LTTNG_UST_CTL_UST_ENUM_ENTRY_OPTION_IS_AUTO) { ret = lttng_metadata_printf(session, ",\n"); if (ret) { goto end; @@ -361,15 +361,15 @@ static int _lttng_variant_statedump(struct ust_registry_session *session, uint32_t nr_choices, const char *tag_name, uint32_t alignment, - const struct ustctl_field *fields, size_t nr_fields, + const struct lttng_ust_ctl_field *fields, size_t nr_fields, size_t *iter_field, size_t nesting) { - const struct ustctl_field *variant = &fields[*iter_field]; + const struct lttng_ust_ctl_field *variant = &fields[*iter_field]; uint32_t i; int ret; char identifier[LTTNG_UST_ABI_SYM_NAME_LEN]; - if (variant->type.atype != ustctl_atype_variant) { + if (variant->type.atype != lttng_ust_ctl_atype_variant) { ret = -EINVAL; goto end; } @@ -428,7 +428,7 @@ end: static int _lttng_field_statedump(struct ust_registry_session *session, - const struct ustctl_field *fields, size_t nr_fields, + const struct lttng_ust_ctl_field *fields, size_t nr_fields, size_t *iter_field, size_t nesting) { int ret = 0; @@ -436,7 +436,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, const char *bo_le = " byte_order = le;"; const char *bo_native = ""; const char *bo_reverse; - const struct ustctl_field *field; + const struct lttng_ust_ctl_field *field; if (*iter_field >= nr_fields) { ret = -EOVERFLOW; @@ -451,7 +451,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, } switch (field->type.atype) { - case ustctl_atype_integer: + case lttng_ust_ctl_atype_integer: ret = print_tabs(session, nesting); if (ret) { goto end; @@ -461,9 +461,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, field->type.u.integer.size, field->type.u.integer.alignment, field->type.u.integer.signedness, - (field->type.u.integer.encoding == ustctl_encode_none) + (field->type.u.integer.encoding == lttng_ust_ctl_encode_none) ? "none" - : (field->type.u.integer.encoding == ustctl_encode_UTF8) + : (field->type.u.integer.encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII", field->type.u.integer.base, @@ -471,14 +471,14 @@ int _lttng_field_statedump(struct ust_registry_session *session, field->name); (*iter_field)++; break; - case ustctl_atype_enum: + case lttng_ust_ctl_atype_enum: ret = ust_metadata_enum_statedump(session, field->type.u.legacy.basic.enumeration.name, field->type.u.legacy.basic.enumeration.id, &field->type.u.legacy.basic.enumeration.container_type, field->name, iter_field, nesting); break; - case ustctl_atype_float: + case lttng_ust_ctl_atype_float: ret = print_tabs(session, nesting); if (ret) { goto end; @@ -492,9 +492,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, field->name); (*iter_field)++; break; - case ustctl_atype_array: + case lttng_ust_ctl_atype_array: { - const struct ustctl_basic_type *elem_type; + const struct lttng_ust_ctl_basic_type *elem_type; ret = print_tabs(session, nesting); if (ret) { @@ -502,7 +502,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, } elem_type = &field->type.u.legacy.array.elem_type; /* Only integers are currently supported in arrays. */ - if (elem_type->atype != ustctl_atype_integer) { + if (elem_type->atype != lttng_ust_ctl_atype_integer) { ret = -EINVAL; goto end; } @@ -511,9 +511,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, elem_type->u.basic.integer.size, elem_type->u.basic.integer.alignment, elem_type->u.basic.integer.signedness, - (elem_type->u.basic.integer.encoding == ustctl_encode_none) + (elem_type->u.basic.integer.encoding == lttng_ust_ctl_encode_none) ? "none" - : (elem_type->u.basic.integer.encoding == ustctl_encode_UTF8) + : (elem_type->u.basic.integer.encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII", elem_type->u.basic.integer.base, @@ -522,11 +522,11 @@ int _lttng_field_statedump(struct ust_registry_session *session, (*iter_field)++; break; } - case ustctl_atype_array_nestable: + case lttng_ust_ctl_atype_array_nestable: { uint32_t array_length; - const struct ustctl_field *array_nestable; - const struct ustctl_type *elem_type; + const struct lttng_ust_ctl_field *array_nestable; + const struct lttng_ust_ctl_type *elem_type; array_length = field->type.u.array_nestable.length; (*iter_field)++; @@ -539,7 +539,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, elem_type = &array_nestable->type; /* Only integers are currently supported in arrays. */ - if (elem_type->atype != ustctl_atype_integer) { + if (elem_type->atype != lttng_ust_ctl_atype_integer) { ret = -EINVAL; goto end; } @@ -567,9 +567,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, elem_type->u.integer.size, elem_type->u.integer.alignment, elem_type->u.integer.signedness, - (elem_type->u.integer.encoding == ustctl_encode_none) + (elem_type->u.integer.encoding == lttng_ust_ctl_encode_none) ? "none" - : (elem_type->u.integer.encoding == ustctl_encode_UTF8) + : (elem_type->u.integer.encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII", elem_type->u.integer.base, @@ -578,10 +578,10 @@ int _lttng_field_statedump(struct ust_registry_session *session, (*iter_field)++; break; } - case ustctl_atype_sequence: + case lttng_ust_ctl_atype_sequence: { - const struct ustctl_basic_type *elem_type; - const struct ustctl_basic_type *length_type; + const struct lttng_ust_ctl_basic_type *elem_type; + const struct lttng_ust_ctl_basic_type *length_type; elem_type = &field->type.u.legacy.sequence.elem_type; length_type = &field->type.u.legacy.sequence.length_type; @@ -591,7 +591,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, } /* Only integers are currently supported in sequences. */ - if (elem_type->atype != ustctl_atype_integer) { + if (elem_type->atype != lttng_ust_ctl_atype_integer) { ret = -EINVAL; goto end; } @@ -601,9 +601,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, length_type->u.basic.integer.size, (unsigned int) length_type->u.basic.integer.alignment, length_type->u.basic.integer.signedness, - (length_type->u.basic.integer.encoding == ustctl_encode_none) + (length_type->u.basic.integer.encoding == lttng_ust_ctl_encode_none) ? "none" - : ((length_type->u.basic.integer.encoding == ustctl_encode_UTF8) + : ((length_type->u.basic.integer.encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII"), length_type->u.basic.integer.base, @@ -622,9 +622,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, elem_type->u.basic.integer.size, (unsigned int) elem_type->u.basic.integer.alignment, elem_type->u.basic.integer.signedness, - (elem_type->u.basic.integer.encoding == ustctl_encode_none) + (elem_type->u.basic.integer.encoding == lttng_ust_ctl_encode_none) ? "none" - : ((elem_type->u.basic.integer.encoding == ustctl_encode_UTF8) + : ((elem_type->u.basic.integer.encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII"), elem_type->u.basic.integer.base, @@ -634,10 +634,10 @@ int _lttng_field_statedump(struct ust_registry_session *session, (*iter_field)++; break; } - case ustctl_atype_sequence_nestable: + case lttng_ust_ctl_atype_sequence_nestable: { - const struct ustctl_field *sequence_nestable; - const struct ustctl_type *elem_type; + const struct lttng_ust_ctl_field *sequence_nestable; + const struct lttng_ust_ctl_type *elem_type; (*iter_field)++; if (*iter_field >= nr_fields) { @@ -648,7 +648,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, elem_type = &sequence_nestable->type; /* Only integers are currently supported in sequences. */ - if (elem_type->atype != ustctl_atype_integer) { + if (elem_type->atype != lttng_ust_ctl_atype_integer) { ret = -EINVAL; goto end; } @@ -676,9 +676,9 @@ int _lttng_field_statedump(struct ust_registry_session *session, elem_type->u.integer.size, (unsigned int) elem_type->u.integer.alignment, elem_type->u.integer.signedness, - (elem_type->u.integer.encoding == ustctl_encode_none) + (elem_type->u.integer.encoding == lttng_ust_ctl_encode_none) ? "none" - : ((elem_type->u.integer.encoding == ustctl_encode_UTF8) + : ((elem_type->u.integer.encoding == lttng_ust_ctl_encode_UTF8) ? "UTF8" : "ASCII"), elem_type->u.integer.base, @@ -688,7 +688,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, (*iter_field)++; break; } - case ustctl_atype_string: + case lttng_ust_ctl_atype_string: /* Default encoding is UTF8 */ ret = print_tabs(session, nesting); if (ret) { @@ -696,12 +696,12 @@ int _lttng_field_statedump(struct ust_registry_session *session, } ret = lttng_metadata_printf(session, "string%s _%s;\n", - field->type.u.string.encoding == ustctl_encode_ASCII ? + field->type.u.string.encoding == lttng_ust_ctl_encode_ASCII ? " { encoding = ASCII; }" : "", field->name); (*iter_field)++; break; - case ustctl_atype_variant: + case lttng_ust_ctl_atype_variant: ret = _lttng_variant_statedump(session, field->type.u.legacy.variant.nr_choices, field->type.u.legacy.variant.tag_name, @@ -711,7 +711,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, goto end; } break; - case ustctl_atype_variant_nestable: + case lttng_ust_ctl_atype_variant_nestable: ret = _lttng_variant_statedump(session, field->type.u.variant_nestable.nr_choices, field->type.u.variant_nestable.tag_name, @@ -721,7 +721,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, goto end; } break; - case ustctl_atype_struct: + case lttng_ust_ctl_atype_struct: if (field->type.u.legacy._struct.nr_fields != 0) { /* Currently only 0-length structures are supported. */ ret = -EINVAL; @@ -736,7 +736,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, field->name); (*iter_field)++; break; - case ustctl_atype_struct_nestable: + case lttng_ust_ctl_atype_struct_nestable: if (field->type.u.struct_nestable.nr_fields != 0) { /* Currently only 0-length structures are supported. */ ret = -EINVAL; @@ -761,10 +761,10 @@ int _lttng_field_statedump(struct ust_registry_session *session, } (*iter_field)++; break; - case ustctl_atype_enum_nestable: + case lttng_ust_ctl_atype_enum_nestable: { - const struct ustctl_field *container_field; - const struct ustctl_type *container_type; + const struct lttng_ust_ctl_field *container_field; + const struct lttng_ust_ctl_type *container_type; (*iter_field)++; if (*iter_field >= nr_fields) { @@ -775,7 +775,7 @@ int _lttng_field_statedump(struct ust_registry_session *session, container_type = &container_field->type; /* Only integers are supported as container types. */ - if (container_type->atype != ustctl_atype_integer) { + if (container_type->atype != lttng_ust_ctl_atype_integer) { ret = -EINVAL; goto end; } @@ -796,7 +796,7 @@ end: static int _lttng_context_metadata_statedump(struct ust_registry_session *session, size_t nr_ctx_fields, - struct ustctl_field *ctx) + struct lttng_ust_ctl_field *ctx) { int ret = 0; size_t i = 0; @@ -922,7 +922,7 @@ int ust_metadata_channel_statedump(struct ust_registry_session *session, " event.header := %s;\n" " packet.context := struct packet_context;\n", chan->chan_id, - chan->header_type == USTCTL_CHANNEL_HEADER_COMPACT ? + chan->header_type == LTTNG_UST_CTL_CHANNEL_HEADER_COMPACT ? "struct event_header_compact" : "struct event_header_large"); if (ret) { diff --git a/src/bin/lttng-sessiond/ust-registry.c b/src/bin/lttng-sessiond/ust-registry.c index e1984af5f..8a6d313f0 100644 --- a/src/bin/lttng-sessiond/ust-registry.c +++ b/src/bin/lttng-sessiond/ust-registry.c @@ -54,7 +54,7 @@ static int ht_match_event(struct cds_lfht_node *node, const void *_key) /* Compare each field individually. */ for (i = 0; i < event->nr_fields; i++) { - if (!match_ustctl_field(&event->fields[i], &key->fields[i])) { + if (!match_lttng_ust_ctl_field(&event->fields[i], &key->fields[i])) { goto no_match; } } @@ -101,7 +101,7 @@ static int compare_enums(const struct ust_registry_enum *reg_enum_a, goto end; } for (i = 0; i < reg_enum_a->nr_entries; i++) { - const struct ustctl_enum_entry *entries_a, *entries_b; + const struct lttng_ust_ctl_enum_entry *entries_a, *entries_b; entries_a = ®_enum_a->entries[i]; entries_b = ®_enum_b->entries[i]; @@ -209,32 +209,32 @@ static unsigned long ht_hash_enum(void *_key, unsigned long seed) * trace reader. */ static -int validate_event_field(struct ustctl_field *field, +int validate_event_field(struct lttng_ust_ctl_field *field, const char *event_name, struct ust_app *app) { int ret = 0; switch(field->type.atype) { - case ustctl_atype_integer: - case ustctl_atype_enum: - case ustctl_atype_array: - case ustctl_atype_sequence: - case ustctl_atype_string: - case ustctl_atype_variant: - case ustctl_atype_array_nestable: - case ustctl_atype_sequence_nestable: - case ustctl_atype_enum_nestable: - case ustctl_atype_variant_nestable: + case lttng_ust_ctl_atype_integer: + case lttng_ust_ctl_atype_enum: + case lttng_ust_ctl_atype_array: + case lttng_ust_ctl_atype_sequence: + case lttng_ust_ctl_atype_string: + case lttng_ust_ctl_atype_variant: + case lttng_ust_ctl_atype_array_nestable: + case lttng_ust_ctl_atype_sequence_nestable: + case lttng_ust_ctl_atype_enum_nestable: + case lttng_ust_ctl_atype_variant_nestable: break; - case ustctl_atype_struct: + case lttng_ust_ctl_atype_struct: if (field->type.u.legacy._struct.nr_fields != 0) { WARN("Unsupported non-empty struct field."); ret = -EINVAL; goto end; } break; - case ustctl_atype_struct_nestable: + case lttng_ust_ctl_atype_struct_nestable: if (field->type.u.struct_nestable.nr_fields != 0) { WARN("Unsupported non-empty struct field."); ret = -EINVAL; @@ -242,7 +242,7 @@ int validate_event_field(struct ustctl_field *field, } break; - case ustctl_atype_float: + case lttng_ust_ctl_atype_float: switch (field->type.u._float.mant_dig) { case 0: WARN("UST application '%s' (pid: %d) has unknown float mantissa '%u' " @@ -267,7 +267,7 @@ end: } static -int validate_event_fields(size_t nr_fields, struct ustctl_field *fields, +int validate_event_fields(size_t nr_fields, struct lttng_ust_ctl_field *fields, const char *event_name, struct ust_app *app) { unsigned int i; @@ -285,7 +285,7 @@ int validate_event_fields(size_t nr_fields, struct ustctl_field *fields, */ static struct ust_registry_event *alloc_event(int session_objd, int channel_objd, char *name, char *sig, size_t nr_fields, - struct ustctl_field *fields, int loglevel_value, + struct lttng_ust_ctl_field *fields, int loglevel_value, char *model_emf_uri, struct ust_app *app) { struct ust_registry_event *event = NULL; @@ -400,7 +400,7 @@ end: */ int ust_registry_create_event(struct ust_registry_session *session, uint64_t chan_key, int session_objd, int channel_objd, char *name, - char *sig, size_t nr_fields, struct ustctl_field *fields, + char *sig, size_t nr_fields, struct lttng_ust_ctl_field *fields, int loglevel_value, char *model_emf_uri, int buffer_type, uint32_t *event_id_p, struct ust_app *app) { @@ -611,7 +611,7 @@ end: */ int ust_registry_create_or_find_enum(struct ust_registry_session *session, int session_objd, char *enum_name, - struct ustctl_enum_entry *entries, size_t nr_entries, + struct lttng_ust_ctl_enum_entry *entries, size_t nr_entries, uint64_t *enum_id) { int ret = 0; diff --git a/src/bin/lttng-sessiond/ust-registry.h b/src/bin/lttng-sessiond/ust-registry.h index ba1ff75d3..a25cdc70d 100644 --- a/src/bin/lttng-sessiond/ust-registry.h +++ b/src/bin/lttng-sessiond/ust-registry.h @@ -132,7 +132,7 @@ struct ust_registry_channel { uint64_t consumer_key; /* Id set when replying to a register channel. */ uint32_t chan_id; - enum ustctl_channel_header header_type; + enum lttng_ust_ctl_channel_header header_type; /* * Flag for this channel if the metadata was dumped once during @@ -156,7 +156,7 @@ struct ust_registry_channel { * register channel notification from the UST tracer. */ size_t nr_ctx_fields; - struct ustctl_field *ctx_fields; + struct lttng_ust_ctl_field *ctx_fields; struct lttng_ht_node_u64 node; /* For delayed reclaim */ struct rcu_head rcu_head; @@ -176,7 +176,7 @@ struct ust_registry_event { char *signature; int loglevel_value; size_t nr_fields; - struct ustctl_field *fields; + struct lttng_ust_ctl_field *fields; char *model_emf_uri; /* * Flag for this channel if the metadata was dumped once during @@ -192,7 +192,7 @@ struct ust_registry_event { struct ust_registry_enum { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; - struct ustctl_enum_entry *entries; + struct lttng_ust_ctl_enum_entry *entries; size_t nr_entries; uint64_t id; /* enum id in session */ /* Enumeration node in session hash table. */ @@ -292,7 +292,7 @@ void ust_registry_session_destroy(struct ust_registry_session *session); int ust_registry_create_event(struct ust_registry_session *session, uint64_t chan_key, int session_objd, int channel_objd, char *name, - char *sig, size_t nr_fields, struct ustctl_field *fields, + char *sig, size_t nr_fields, struct lttng_ust_ctl_field *fields, int loglevel_value, char *model_emf_uri, int buffer_type, uint32_t *event_id_p, struct ust_app *app); struct ust_registry_event *ust_registry_find_event( @@ -310,7 +310,7 @@ int ust_metadata_event_statedump(struct ust_registry_session *session, struct ust_registry_event *event); int ust_registry_create_or_find_enum(struct ust_registry_session *session, int session_objd, char *name, - struct ustctl_enum_entry *entries, size_t nr_entries, + struct lttng_ust_ctl_enum_entry *entries, size_t nr_entries, uint64_t *enum_id); struct ust_registry_enum * ust_registry_lookup_enum_by_id(struct ust_registry_session *session, @@ -365,7 +365,7 @@ void ust_registry_session_destroy(struct ust_registry_session *session) static inline int ust_registry_create_event(struct ust_registry_session *session, uint64_t chan_key, int session_objd, int channel_objd, char *name, - char *sig, size_t nr_fields, struct ustctl_field *fields, + char *sig, size_t nr_fields, struct lttng_ust_ctl_field *fields, int loglevel_value, char *model_emf_uri, int buffer_type, uint32_t *event_id_p) { @@ -405,7 +405,7 @@ int ust_metadata_event_statedump(struct ust_registry_session *session, static inline int ust_registry_create_or_find_enum(struct ust_registry_session *session, int session_objd, char *name, - struct ustctl_enum_entry *entries, size_t nr_entries, + struct lttng_ust_ctl_enum_entry *entries, size_t nr_entries, uint64_t *enum_id) { return 0; diff --git a/src/common/consumer/consumer-metadata-cache.h b/src/common/consumer/consumer-metadata-cache.h index b207cc79c..b8f4efadc 100644 --- a/src/common/consumer/consumer-metadata-cache.h +++ b/src/common/consumer/consumer-metadata-cache.h @@ -43,7 +43,7 @@ struct consumer_metadata_cache { struct lttng_dynamic_buffer contents; /* * Lock to update the metadata cache and push into the ring_buffer - * (ustctl_write_metadata_to_channel). + * (lttng_ust_ctl_write_metadata_to_channel). * * This is nested INSIDE the consumer_data lock. */ diff --git a/src/common/consumer/consumer-timer.c b/src/common/consumer/consumer-timer.c index 44fdc879f..cbb006278 100644 --- a/src/common/consumer/consumer-timer.c +++ b/src/common/consumer/consumer-timer.c @@ -247,7 +247,7 @@ int consumer_flush_ust_index(struct lttng_consumer_stream *stream) } ret = lttng_ustconsumer_get_stream_id(stream, &stream_id); if (ret < 0) { - PERROR("ustctl_get_stream_id"); + PERROR("lttng_ust_ctl_get_stream_id"); goto end; } DBG("Stream %" PRIu64 " empty, sending beacon", stream->key); diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 5064362c8..e28c20bf1 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -160,7 +160,7 @@ struct lttng_consumer_channel { /* For UST */ uid_t ust_app_uid; /* Application UID. */ - struct ustctl_consumer_channel *uchan; + struct lttng_ust_ctl_consumer_channel *uchan; unsigned char uuid[LTTNG_UUID_STR_LEN]; /* * Temporary stream list used to store the streams once created and waiting @@ -540,7 +540,7 @@ struct lttng_consumer_stream { /* Stream name. Format is: _ */ char name[LTTNG_SYMBOL_NAME_LEN]; /* Internal state of libustctl. */ - struct ustctl_consumer_stream *ustream; + struct lttng_ust_ctl_consumer_stream *ustream; struct cds_list_head send_node; /* On-disk circular buffer */ uint64_t tracefile_size_current; diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index bdfb8a0bb..27d346b33 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -66,7 +66,7 @@ static void destroy_channel(struct lttng_consumer_channel *channel) health_code_update(); cds_list_del(&stream->send_node); - ustctl_destroy_stream(stream->ustream); + lttng_ust_ctl_destroy_stream(stream->ustream); lttng_trace_chunk_put(stream->trace_chunk); free(stream); } @@ -250,7 +250,7 @@ static int create_ust_streams(struct lttng_consumer_channel *channel, struct lttng_consumer_local_data *ctx) { int ret, cpu = 0; - struct ustctl_consumer_stream *ustream; + struct lttng_ust_ctl_consumer_stream *ustream; struct lttng_consumer_stream *stream; pthread_mutex_t *current_stream_lock = NULL; @@ -261,7 +261,7 @@ static int create_ust_streams(struct lttng_consumer_channel *channel, * While a stream is available from ustctl. When NULL is returned, we've * reached the end of the possible stream for the channel. */ - while ((ustream = ustctl_create_stream(channel->uchan, cpu))) { + while ((ustream = lttng_ust_ctl_create_stream(channel->uchan, cpu))) { int wait_fd; int ust_metadata_pipe[2]; @@ -275,7 +275,7 @@ static int create_ust_streams(struct lttng_consumer_channel *channel, } wait_fd = ust_metadata_pipe[0]; } else { - wait_fd = ustctl_stream_get_wait_fd(ustream); + wait_fd = lttng_ust_ctl_stream_get_wait_fd(ustream); } /* Allocate consumer stream object. */ @@ -307,10 +307,10 @@ static int create_ust_streams(struct lttng_consumer_channel *channel, */ cds_list_add_tail(&stream->send_node, &channel->streams.head); - ret = ustctl_get_max_subbuf_size(stream->ustream, + ret = lttng_ust_ctl_get_max_subbuf_size(stream->ustream, &stream->max_sb_size); if (ret < 0) { - ERR("ustctl_get_max_subbuf_size failed for stream %s", + ERR("lttng_ust_ctl_get_max_subbuf_size failed for stream %s", stream->name); goto error; } @@ -382,12 +382,12 @@ error_shm_path: * Return 0 on success or else a negative value. */ static int create_ust_channel(struct lttng_consumer_channel *channel, - struct ustctl_consumer_channel_attr *attr, - struct ustctl_consumer_channel **ust_chanp) + struct lttng_ust_ctl_consumer_channel_attr *attr, + struct lttng_ust_ctl_consumer_channel **ust_chanp) { int ret, nr_stream_fds, i, j; int *stream_fds; - struct ustctl_consumer_channel *ust_channel; + struct lttng_ust_ctl_consumer_channel *ust_channel; assert(channel); assert(attr); @@ -404,7 +404,7 @@ static int create_ust_channel(struct lttng_consumer_channel *channel, if (channel->type == CONSUMER_CHANNEL_TYPE_METADATA) nr_stream_fds = 1; else - nr_stream_fds = ustctl_get_nr_stream_per_channel(); + nr_stream_fds = lttng_ust_ctl_get_nr_stream_per_channel(); stream_fds = zmalloc(nr_stream_fds * sizeof(*stream_fds)); if (!stream_fds) { ret = -1; @@ -418,7 +418,7 @@ static int create_ust_channel(struct lttng_consumer_channel *channel, goto error_open; } } - ust_channel = ustctl_create_channel(attr, stream_fds, nr_stream_fds); + ust_channel = lttng_ust_ctl_create_channel(attr, stream_fds, nr_stream_fds); if (!ust_channel) { ret = -1; goto error_create; @@ -485,7 +485,7 @@ static int send_sessiond_stream(int sock, struct lttng_consumer_stream *stream) DBG("UST consumer sending stream %" PRIu64 " to sessiond", stream->key); /* Send stream to session daemon. */ - ret = ustctl_send_stream_to_sessiond(sock, stream->ustream); + ret = lttng_ust_ctl_send_stream_to_sessiond(sock, stream->ustream); if (ret < 0) { goto error; } @@ -549,12 +549,12 @@ static int send_channel_to_sessiond_and_relayd(int sock, } /* Send channel to sessiond. */ - ret = ustctl_send_channel_to_sessiond(sock, channel->uchan); + ret = lttng_ust_ctl_send_channel_to_sessiond(sock, channel->uchan); if (ret < 0) { goto error; } - ret = ustctl_channel_close_wakeup_fd(channel->uchan); + ret = lttng_ust_ctl_channel_close_wakeup_fd(channel->uchan); if (ret < 0) { goto error; } @@ -572,7 +572,7 @@ static int send_channel_to_sessiond_and_relayd(int sock, } /* Tell sessiond there is no more stream. */ - ret = ustctl_send_stream_to_sessiond(sock, NULL); + ret = lttng_ust_ctl_send_stream_to_sessiond(sock, NULL); if (ret < 0) { goto error; } @@ -598,7 +598,7 @@ error: */ static int ask_channel(struct lttng_consumer_local_data *ctx, struct lttng_consumer_channel *channel, - struct ustctl_consumer_channel_attr *attr) + struct lttng_ust_ctl_consumer_channel_attr *attr) { int ret; @@ -627,7 +627,7 @@ static int ask_channel(struct lttng_consumer_local_data *ctx, goto end; } - channel->wait_fd = ustctl_channel_get_wait_fd(channel->uchan); + channel->wait_fd = lttng_ust_ctl_channel_get_wait_fd(channel->uchan); /* * For the snapshots (no monitor), we create the metadata streams @@ -727,7 +727,7 @@ static int flush_channel(uint64_t chan_key) } if (!stream->quiescent) { - ustctl_flush_buffer(stream->ustream, 0); + lttng_ust_ctl_flush_buffer(stream->ustream, 0); stream->quiescent = true; } next: @@ -1039,7 +1039,7 @@ int get_current_subbuf_addr(struct lttng_consumer_stream *stream, unsigned long mmap_offset; const char *mmap_base; - mmap_base = ustctl_get_mmap_base(stream->ustream); + mmap_base = lttng_ust_ctl_get_mmap_base(stream->ustream); if (!mmap_base) { ERR("Failed to get mmap base for stream `%s`", stream->name); @@ -1047,7 +1047,7 @@ int get_current_subbuf_addr(struct lttng_consumer_stream *stream, goto error; } - ret = ustctl_get_mmap_read_offset(stream->ustream, &mmap_offset); + ret = lttng_ust_ctl_get_mmap_read_offset(stream->ustream, &mmap_offset); if (ret != 0) { ERR("Failed to get mmap offset for stream `%s`", stream->name); ret = -EINVAL; @@ -1128,7 +1128,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel, * Else, if quiescent, it has already been done by the prior stop. */ if (!stream->quiescent) { - ustctl_flush_buffer(stream->ustream, 0); + lttng_ust_ctl_flush_buffer(stream->ustream, 0); } ret = lttng_ustconsumer_take_snapshot(stream); @@ -1169,10 +1169,10 @@ static int snapshot_channel(struct lttng_consumer_channel *channel, DBG("UST consumer taking snapshot at pos %lu", consumed_pos); - ret = ustctl_get_subbuf(stream->ustream, &consumed_pos); + ret = lttng_ust_ctl_get_subbuf(stream->ustream, &consumed_pos); if (ret < 0) { if (ret != -EAGAIN) { - PERROR("ustctl_get_subbuf snapshot"); + PERROR("lttng_ust_ctl_get_subbuf snapshot"); goto error_close_stream; } DBG("UST consumer get subbuf failed. Skipping it."); @@ -1181,15 +1181,15 @@ static int snapshot_channel(struct lttng_consumer_channel *channel, continue; } - ret = ustctl_get_subbuf_size(stream->ustream, &len); + ret = lttng_ust_ctl_get_subbuf_size(stream->ustream, &len); if (ret < 0) { - ERR("Snapshot ustctl_get_subbuf_size"); + ERR("Snapshot lttng_ust_ctl_get_subbuf_size"); goto error_put_subbuf; } - ret = ustctl_get_padded_subbuf_size(stream->ustream, &padded_len); + ret = lttng_ust_ctl_get_padded_subbuf_size(stream->ustream, &padded_len); if (ret < 0) { - ERR("Snapshot ustctl_get_padded_subbuf_size"); + ERR("Snapshot lttng_ust_ctl_get_padded_subbuf_size"); goto error_put_subbuf; } @@ -1214,9 +1214,9 @@ static int snapshot_channel(struct lttng_consumer_channel *channel, } } - ret = ustctl_put_subbuf(stream->ustream); + ret = lttng_ust_ctl_put_subbuf(stream->ustream); if (ret < 0) { - ERR("Snapshot ustctl_put_subbuf"); + ERR("Snapshot lttng_ust_ctl_put_subbuf"); goto error_close_stream; } consumed_pos += stream->max_sb_size; @@ -1231,8 +1231,8 @@ static int snapshot_channel(struct lttng_consumer_channel *channel, return 0; error_put_subbuf: - if (ustctl_put_subbuf(stream->ustream) < 0) { - ERR("Snapshot ustctl_put_subbuf"); + if (lttng_ust_ctl_put_subbuf(stream->ustream) < 0) { + ERR("Snapshot lttng_ust_ctl_put_subbuf"); } error_close_stream: consumer_stream_close(stream); @@ -1473,7 +1473,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, case LTTNG_CONSUMER_ASK_CHANNEL_CREATION: { int ret_ask_channel, ret_add_channel, ret_send; - struct ustctl_consumer_channel_attr attr; + struct lttng_ust_ctl_consumer_channel_attr attr; const uint64_t chunk_id = msg.u.ask_channel.chunk_id.value; const struct lttng_credentials buffer_credentials = { .uid = LTTNG_OPTIONAL_INIT_VALUE(msg.u.ask_channel.buffer_credentials.uid), @@ -2314,13 +2314,13 @@ end: return ret_func; } -void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream, +void lttng_lttng_ust_ctl_flush_buffer(struct lttng_consumer_stream *stream, int producer_active) { assert(stream); assert(stream->ustream); - ustctl_flush_buffer(stream->ustream, producer_active); + lttng_ust_ctl_flush_buffer(stream->ustream, producer_active); } /* @@ -2333,7 +2333,7 @@ int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream) assert(stream); assert(stream->ustream); - return ustctl_snapshot(stream->ustream); + return lttng_ust_ctl_snapshot(stream->ustream); } /* @@ -2347,7 +2347,7 @@ int lttng_ustconsumer_sample_snapshot_positions( assert(stream); assert(stream->ustream); - return ustctl_snapshot_sample_positions(stream->ustream); + return lttng_ust_ctl_snapshot_sample_positions(stream->ustream); } /* @@ -2362,7 +2362,7 @@ int lttng_ustconsumer_get_produced_snapshot( assert(stream->ustream); assert(pos); - return ustctl_snapshot_get_produced(stream->ustream, pos); + return lttng_ust_ctl_snapshot_get_produced(stream->ustream, pos); } /* @@ -2377,7 +2377,7 @@ int lttng_ustconsumer_get_consumed_snapshot( assert(stream->ustream); assert(pos); - return ustctl_snapshot_get_consumed(stream->ustream, pos); + return lttng_ust_ctl_snapshot_get_consumed(stream->ustream, pos); } void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, @@ -2386,7 +2386,7 @@ void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, assert(stream); assert(stream->ustream); - ustctl_flush_buffer(stream->ustream, producer); + lttng_ust_ctl_flush_buffer(stream->ustream, producer); } void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) @@ -2394,7 +2394,7 @@ void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) assert(stream); assert(stream->ustream); - ustctl_clear_buffer(stream->ustream); + lttng_ust_ctl_clear_buffer(stream->ustream); } int lttng_ustconsumer_get_current_timestamp( @@ -2404,7 +2404,7 @@ int lttng_ustconsumer_get_current_timestamp( assert(stream->ustream); assert(ts); - return ustctl_get_current_timestamp(stream->ustream, ts); + return lttng_ust_ctl_get_current_timestamp(stream->ustream, ts); } int lttng_ustconsumer_get_sequence_number( @@ -2414,7 +2414,7 @@ int lttng_ustconsumer_get_sequence_number( assert(stream->ustream); assert(seq); - return ustctl_get_sequence_number(stream->ustream, seq); + return lttng_ust_ctl_get_sequence_number(stream->ustream, seq); } /* @@ -2427,7 +2427,7 @@ void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) pthread_mutex_lock(&stream->lock); if (!stream->quiescent) { - ustctl_flush_buffer(stream->ustream, 0); + lttng_ust_ctl_flush_buffer(stream->ustream, 0); stream->quiescent = true; } pthread_mutex_unlock(&stream->lock); @@ -2478,7 +2478,7 @@ void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan) assert(chan->buffer_credentials.is_set); consumer_metadata_cache_destroy(chan); - ustctl_destroy_channel(chan->uchan); + lttng_ust_ctl_destroy_channel(chan->uchan); /* Try to rmdir all directories under shm_path root. */ if (chan->root_shm_path[0]) { (void) run_as_rmdir_recursive(chan->root_shm_path, @@ -2499,7 +2499,7 @@ void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) if (stream->chan->switch_timer_enabled == 1) { consumer_timer_switch_stop(stream->chan); } - ustctl_destroy_stream(stream->ustream); + lttng_ust_ctl_destroy_stream(stream->ustream); } int lttng_ustconsumer_get_wakeup_fd(struct lttng_consumer_stream *stream) @@ -2507,7 +2507,7 @@ int lttng_ustconsumer_get_wakeup_fd(struct lttng_consumer_stream *stream) assert(stream); assert(stream->ustream); - return ustctl_stream_get_wakeup_fd(stream->ustream); + return lttng_ust_ctl_stream_get_wakeup_fd(stream->ustream); } int lttng_ustconsumer_close_wakeup_fd(struct lttng_consumer_stream *stream) @@ -2515,7 +2515,7 @@ int lttng_ustconsumer_close_wakeup_fd(struct lttng_consumer_stream *stream) assert(stream); assert(stream->ustream); - return ustctl_stream_close_wakeup_fd(stream->ustream); + return lttng_ust_ctl_stream_close_wakeup_fd(stream->ustream); } /* @@ -2568,7 +2568,7 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream) } } - write_len = ustctl_write_one_packet_to_channel(stream->chan->uchan, + write_len = lttng_ust_ctl_write_one_packet_to_channel(stream->chan->uchan, &stream->chan->metadata_cache->contents.data[stream->ust_metadata_pushed], stream->chan->metadata_cache->contents.size - stream->ust_metadata_pushed); @@ -2589,7 +2589,7 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream) * a metadata packet. Since the subbuffer is fully filled (with padding, * if needed), the stream is "quiescent" after this commit. */ - ustctl_flush_buffer(stream->ustream, 1); + lttng_ust_ctl_flush_buffer(stream->ustream, 1); stream->quiescent = true; end: pthread_mutex_unlock(&stream->chan->metadata_cache->lock); @@ -2660,7 +2660,7 @@ enum sync_metadata_status lttng_ustconsumer_sync_metadata( goto end; } - ret = ustctl_snapshot(metadata_stream->ustream); + ret = lttng_ust_ctl_snapshot(metadata_stream->ustream); if (ret < 0) { ERR("Failed to take a snapshot of the metadata ring-buffer positions, ret = %d", ret); status = SYNC_METADATA_STATUS_ERROR; @@ -2678,7 +2678,7 @@ static int notify_if_more_data(struct lttng_consumer_stream *stream, struct lttng_consumer_local_data *ctx) { int ret; - struct ustctl_consumer_stream *ustream; + struct lttng_ust_ctl_consumer_stream *ustream; assert(stream); assert(ctx); @@ -2690,7 +2690,7 @@ static int notify_if_more_data(struct lttng_consumer_stream *stream, * before reading the stream wait_fd. */ /* Get the next subbuffer */ - ret = ustctl_get_next_subbuf(ustream); + ret = lttng_ust_ctl_get_next_subbuf(ustream); if (ret) { /* No more data found, flag the stream. */ stream->has_data = 0; @@ -2698,7 +2698,7 @@ static int notify_if_more_data(struct lttng_consumer_stream *stream, goto end; } - ret = ustctl_put_subbuf(ustream); + ret = lttng_ust_ctl_put_subbuf(ustream); assert(!ret); /* This stream still has data. Flag it and wake up the data thread. */ @@ -2755,13 +2755,13 @@ static int extract_common_subbuffer_info(struct lttng_consumer_stream *stream, { int ret; - ret = ustctl_get_subbuf_size( + ret = lttng_ust_ctl_get_subbuf_size( stream->ustream, &subbuf->info.data.subbuf_size); if (ret) { goto end; } - ret = ustctl_get_padded_subbuf_size( + ret = lttng_ust_ctl_get_padded_subbuf_size( stream->ustream, &subbuf->info.data.padded_subbuf_size); if (ret) { goto end; @@ -2797,42 +2797,42 @@ static int extract_data_subbuffer_info(struct lttng_consumer_stream *stream, goto end; } - ret = ustctl_get_packet_size( + ret = lttng_ust_ctl_get_packet_size( stream->ustream, &subbuf->info.data.packet_size); if (ret < 0) { PERROR("Failed to get sub-buffer packet size"); goto end; } - ret = ustctl_get_content_size( + ret = lttng_ust_ctl_get_content_size( stream->ustream, &subbuf->info.data.content_size); if (ret < 0) { PERROR("Failed to get sub-buffer content size"); goto end; } - ret = ustctl_get_timestamp_begin( + ret = lttng_ust_ctl_get_timestamp_begin( stream->ustream, &subbuf->info.data.timestamp_begin); if (ret < 0) { PERROR("Failed to get sub-buffer begin timestamp"); goto end; } - ret = ustctl_get_timestamp_end( + ret = lttng_ust_ctl_get_timestamp_end( stream->ustream, &subbuf->info.data.timestamp_end); if (ret < 0) { PERROR("Failed to get sub-buffer end timestamp"); goto end; } - ret = ustctl_get_events_discarded( + ret = lttng_ust_ctl_get_events_discarded( stream->ustream, &subbuf->info.data.events_discarded); if (ret) { PERROR("Failed to get sub-buffer events discarded count"); goto end; } - ret = ustctl_get_sequence_number(stream->ustream, + ret = lttng_ust_ctl_get_sequence_number(stream->ustream, &subbuf->info.data.sequence_number.value); if (ret) { /* May not be supported by older LTTng-modules. */ @@ -2844,14 +2844,14 @@ static int extract_data_subbuffer_info(struct lttng_consumer_stream *stream, subbuf->info.data.sequence_number.is_set = true; } - ret = ustctl_get_stream_id( + ret = lttng_ust_ctl_get_stream_id( stream->ustream, &subbuf->info.data.stream_id); if (ret < 0) { PERROR("Failed to get stream id"); goto end; } - ret = ustctl_get_instance_id(stream->ustream, + ret = lttng_ust_ctl_get_instance_id(stream->ustream, &subbuf->info.data.stream_instance_id.value); if (ret) { /* May not be supported by older LTTng-modules. */ @@ -2895,7 +2895,7 @@ static int get_next_subbuffer(struct lttng_consumer_stream *stream, { int ret; - ret = ustctl_get_next_subbuf(stream->ustream); + ret = lttng_ust_ctl_get_next_subbuf(stream->ustream); if (ret) { goto end; } @@ -2919,7 +2919,7 @@ static int get_next_subbuffer_metadata(struct lttng_consumer_stream *stream, unsigned long consumed_pos, produced_pos; do { - ret = ustctl_get_next_subbuf(stream->ustream); + ret = lttng_ust_ctl_get_next_subbuf(stream->ustream); if (ret == 0) { got_subbuffer = true; } else { @@ -3001,7 +3001,7 @@ end: static int put_next_subbuffer(struct lttng_consumer_stream *stream, struct stream_subbuffer *subbuffer) { - const int ret = ustctl_put_next_subbuf(stream->ustream); + const int ret = lttng_ust_ctl_put_next_subbuf(stream->ustream); assert(ret == 0); return ret; @@ -3133,13 +3133,13 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream) goto end; } } else { - ret = ustctl_get_next_subbuf(stream->ustream); + ret = lttng_ust_ctl_get_next_subbuf(stream->ustream); if (ret == 0) { /* * There is still data so let's put back this * subbuffer. */ - ret = ustctl_put_subbuf(stream->ustream); + ret = lttng_ust_ctl_put_subbuf(stream->ustream); assert(ret == 0); ret = 1; /* Data is pending */ goto end; @@ -3229,7 +3229,7 @@ void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream) { int ret; - ret = ustctl_stream_close_wakeup_fd(stream->ustream); + ret = lttng_ust_ctl_stream_close_wakeup_fd(stream->ustream); if (ret < 0) { ERR("Unable to close wakeup fd"); } @@ -3380,5 +3380,5 @@ int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, assert(stream); assert(stream_id); - return ustctl_get_stream_id(stream->ustream, stream_id); + return lttng_ust_ctl_get_stream_id(stream->ustream, stream_id); } diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h index bd3233700..31a734c77 100644 --- a/src/common/ust-consumer/ust-consumer.h +++ b/src/common/ust-consumer/ust-consumer.h @@ -39,7 +39,7 @@ int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); -void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream, +void lttng_lttng_ust_ctl_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); @@ -163,7 +163,7 @@ void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) } static inline -int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream *stream, +int lttng_lttng_ust_ctl_get_mmap_read_offset(struct lttng_consumer_stream *stream, unsigned long *off) { return -ENOSYS; @@ -174,12 +174,12 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream) return -ENOSYS; } static inline -void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream *stream) +void *lttng_lttng_ust_ctl_get_mmap_base(struct lttng_consumer_stream *stream) { return NULL; } static inline -void lttng_ustctl_flush_buffer(struct lttng_consumer_stream *stream, +void lttng_lttng_ust_ctl_flush_buffer(struct lttng_consumer_stream *stream, int producer_active) { } -- 2.34.1