* Domain types: the different possible tracers.
*/
enum lttng_domain_type {
+ LTTNG_DOMAIN_NONE = 0, /* No associated domain. */
LTTNG_DOMAIN_KERNEL = 1, /* Linux Kernel tracer. */
LTTNG_DOMAIN_UST = 2, /* Global Userspace tracer. */
LTTNG_DOMAIN_JUL = 3, /* Java Util Logging. */
* This handle contains the session name and domain on which the command will
* be executed. A domain is basically a tracer like the kernel or user space.
*
- * Return an newly allocated handle that should be freed using
+ * A NULL domain indicates that the handle is not bound to a specific domain.
+ * This is mostly used for actions that apply on a session and not on a domain
+ * (e.g lttng_set_consumer_url).
+ *
+ * Return a newly allocated handle that should be freed using
* lttng_destroy_handle. On error, NULL is returned.
*/
extern struct lttng_handle *lttng_create_handle(const char *session_name,
{
int ret;
struct lttng_handle *handle;
- struct lttng_domain dom;
assert(session_name);
/*
- * Set handle with the session name and the domain set to 0. This means to
- * the session daemon that the next action applies on the tracing session
- * rather then the domain specific session.
+ * Set handle with the session_name, but no domain. This implies that
+ * the actions taken with this handle apply on the tracing session
+ * rather then the domain-specific session.
*/
- memset(&dom, 0, sizeof(dom));
-
- handle = lttng_create_handle(session_name, &dom);
+ handle = lttng_create_handle(session_name, NULL);
if (handle == NULL) {
ret = CMD_FATAL;
goto error;
}
static
-int create_session_net_output(const char *name, struct lttng_domain *domain,
- const char *control_uri, const char *data_uri)
+int create_session_net_output(const char *name, const char *control_uri,
+ const char *data_uri)
{
int ret;
struct lttng_handle *handle;
const char *uri = NULL;
assert(name);
- assert(domain);
- handle = lttng_create_handle(name, domain);
+ handle = lttng_create_handle(name, NULL);
if (!handle) {
ret = -LTTNG_ERR_NOMEM;
goto end;
}
if (output.control_uri || output.data_uri) {
- int i;
- struct lttng_domain *domain;
- struct lttng_domain *domains[] =
- { kernel_domain, ust_domain, jul_domain, log4j_domain };
-
/* network destination */
if (live_timer_interval && live_timer_interval != UINT64_MAX) {
/*
goto end;
}
- for (i = 0; i < (sizeof(domains) / sizeof(domains[0])); i++) {
- domain = domains[i];
- if (!domain) {
- continue;
- }
-
- ret = create_session_net_output(name, domain, output.control_uri,
- output.data_uri);
- if (ret) {
- goto end;
- }
+ ret = create_session_net_output(name, output.control_uri,
+ output.data_uri);
+ if (ret) {
+ goto end;
}
+
} else {
/* either local output or no output */
ret = lttng_create_session(name, output.path);
{
struct lttng_handle *handle = NULL;
- if (domain == NULL) {
- goto end;
- }
-
handle = zmalloc(sizeof(struct lttng_handle));
if (handle == NULL) {
PERROR("malloc handle");
lttng_ctl_copy_string(handle->session_name, session_name,
sizeof(handle->session_name));
- /* Copy lttng domain */
- lttng_ctl_copy_lttng_domain(&handle->domain, domain);
+ /* Copy lttng domain or leave initialized to 0. */
+ if (domain) {
+ lttng_ctl_copy_lttng_domain(&handle->domain, domain);
+ }
end:
return handle;