+ create_listener();
+
+ /* Get clock the clock source type */
+
+ /* Default clock source */
+ ust_clock_source = CLOCK_TRACE;
+ if (clock_gettime(ust_clock_source, &ts) != 0) {
+ ust_clock_source = CLOCK_MONOTONIC;
+ DBG("UST traces will not be synchronized with LTTng traces");
+ }
+
+ autoprobe_val = getenv("UST_AUTOPROBE");
+ if (autoprobe_val) {
+ struct marker_iter iter;
+
+ DBG("Autoprobe enabled.");
+
+ /* Ensure markers are initialized */
+ //init_markers();
+
+ /* Ensure marker control is initialized, for the probe */
+ init_marker_control();
+
+ /* first, set the callback that will connect the
+ * probe on new markers
+ */
+ if (autoprobe_val[0] == '/') {
+ result = regcomp(&autoprobe_regex, autoprobe_val+1, 0);
+ if (result) {
+ char regexerr[150];
+
+ regerror(result, &autoprobe_regex, regexerr, sizeof(regexerr));
+ ERR("cannot parse regex %s (%s), will ignore UST_AUTOPROBE", autoprobe_val, regexerr);
+ /* don't crash the application just for this */
+ } else {
+ autoprobe_method = AUTOPROBE_ENABLE_REGEX;
+ }
+ } else {
+ /* just enable all instrumentation */
+ autoprobe_method = AUTOPROBE_ENABLE_ALL;
+ }
+
+ marker_set_new_marker_cb(auto_probe_connect);
+
+ /* Now, connect the probes that were already registered. */
+ marker_iter_reset(&iter);
+ marker_iter_start(&iter);
+
+ DBG("now iterating on markers already registered");
+ while (iter.marker) {
+ DBG("now iterating on marker %s", (*iter.marker)->name);
+ auto_probe_connect(*iter.marker);
+ marker_iter_next(&iter);
+ }
+ }
+
+ if (getenv("UST_OVERWRITE")) {
+ int val = atoi(getenv("UST_OVERWRITE"));
+ if (val == 0 || val == 1) {
+ CMM_STORE_SHARED(ust_channels_overwrite_by_default, val);
+ } else {
+ WARN("invalid value for UST_OVERWRITE");
+ }
+ }
+
+ if (getenv("UST_AUTOCOLLECT")) {
+ int val = atoi(getenv("UST_AUTOCOLLECT"));
+ if (val == 0 || val == 1) {
+ CMM_STORE_SHARED(ust_channels_request_collection_by_default, val);
+ } else {
+ WARN("invalid value for UST_AUTOCOLLECT");
+ }
+ }
+
+ subbuffer_size_val = getenv("UST_SUBBUF_SIZE");
+ if (subbuffer_size_val) {
+ sscanf(subbuffer_size_val, "%u", &subbuffer_size);
+ power = pow2_higher_or_eq(subbuffer_size);
+ if (power != subbuffer_size)
+ WARN("using the next power of two for buffer size = %u\n", power);
+ chan_infos[LTT_CHANNEL_UST].def_subbufsize = power;
+ }
+
+ subbuffer_count_val = getenv("UST_SUBBUF_NUM");
+ if (subbuffer_count_val) {
+ sscanf(subbuffer_count_val, "%u", &subbuffer_count);
+ if (subbuffer_count < 2)
+ subbuffer_count = 2;
+ chan_infos[LTT_CHANNEL_UST].def_subbufcount = subbuffer_count;
+ }
+
+ if (getenv("UST_TRACE")) {