+ if (opt_kernel && opt_userspace) {
+ ERR("Can't use -k/--kernel and -u/--userspace together");
+ ret = CMD_FATAL;
+ goto error;
+ }
+
+ if (opt_kernel) {
+ dom.type = LTTNG_DOMAIN_KERNEL;
+ } else if (opt_pid != 0) {
+ dom.type = LTTNG_DOMAIN_UST_PID;
+ dom.attr.pid = opt_pid;
+ DBG("PID %d set to lttng handle", opt_pid);
+ } else if (opt_userspace && opt_cmd_name == NULL) {
+ dom.type = LTTNG_DOMAIN_UST;
+ DBG("UST global domain selected");
+ } else if (opt_userspace && opt_cmd_name != NULL) {
+ dom.type = LTTNG_DOMAIN_UST_EXEC_NAME;
+ strncpy(dom.attr.exec_name, opt_cmd_name, NAME_MAX);
+ dom.attr.exec_name[NAME_MAX - 1] = '\0';
+ } else {
+ ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ ret = CMD_NOT_IMPLEMENTED;
+ goto error;
+ }
+
+ handle = lttng_create_handle(session_name, &dom);
+ if (handle == NULL) {
+ ret = -1;
+ goto error;
+ }
+