+ {
+ uint64_t v;
+
+ errno = 0;
+ opt_arg = poptGetOptArg(pc);
+
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --read-timer parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
+ if (v != (uint32_t) v) {
+ ERR("32-bit overflow in --read-timer parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+ chan_opts.attr.read_timer_interval = (uint32_t) v;
+ DBG("Channel read timer interval set to %d %s",
+ chan_opts.attr.read_timer_interval,
+ USEC_UNIT);
+ break;
+ }
+ case OPT_MONITOR_TIMER:
+ {
+ uint64_t v;
+
+ errno = 0;
+ opt_arg = poptGetOptArg(pc);
+
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --monitor-timer parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+ opt_monitor_timer.interval = (uint64_t) v;
+ opt_monitor_timer.set = true;
+ DBG("Channel monitor timer interval set to %" PRIu64 " %s",
+ opt_monitor_timer.interval,
+ USEC_UNIT);
+ break;
+ }
+ case OPT_BLOCKING_TIMEOUT:
+ {
+ uint64_t v;
+ long long v_msec;
+
+ errno = 0;
+ opt_arg = poptGetOptArg(pc);
+
+ if (strcmp(opt_arg, "inf") == 0) {
+ opt_blocking_timeout.value = (int64_t) -1;
+ opt_blocking_timeout.set = true;
+ DBG("Channel blocking timeout set to infinity");
+ break;
+ }
+
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --blocking-timeout parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
+ /*
+ * While LTTng-UST and LTTng-tools will accept a
+ * blocking timeout expressed in µs, the current
+ * tracer implementation relies on poll() which
+ * takes an "int timeout" parameter expressed in
+ * msec.
+ *
+ * Since the error reporting from the tracer is
+ * not precise, we perform this check here to
+ * provide a helpful error message in case of
+ * overflow.
+ *
+ * The setter (liblttng-ctl) also performs an
+ * equivalent check.
+ */
+ v_msec = v / 1000;
+ if (v_msec != (int32_t) v_msec) {
+ ERR("32-bit milliseconds overflow in --blocking-timeout parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
+ opt_blocking_timeout.value = (int64_t) v;
+ opt_blocking_timeout.set = true;
+ DBG("Channel blocking timeout set to %" PRId64 " %s%s",
+ opt_blocking_timeout.value,
+ USEC_UNIT,
+ opt_blocking_timeout.value == 0 ?
+ " (non-blocking)" : "");