- exit(EXIT_SUCCESS);
- }
-
- pidit = opts.pids;
- struct marker_status *cmsf = NULL;
- struct trace_event_status *tes = NULL;
- unsigned int i = 0;
-
- while(*pidit != -1) {
- switch (opts.cmd) {
- case CREATE_TRACE:
- result = ustcmd_create_trace(*pidit);
- if (result) {
- ERR("error while trying to create trace with PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
- break;
-
- case START_TRACE:
- result = ustcmd_start_trace(*pidit);
- if (result) {
- ERR("error while trying to for trace with PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
- break;
-
- case STOP_TRACE:
- result = ustcmd_stop_trace(*pidit);
- if (result) {
- ERR("error while trying to stop trace for PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
- break;
-
- case DESTROY_TRACE:
- result = ustcmd_destroy_trace(*pidit);
- if (result) {
- ERR("error while trying to destroy trace with PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
- break;
-
- case LIST_MARKERS:
- cmsf = NULL;
- if (ustcmd_get_cmsf(&cmsf, *pidit)) {
- ERR("error while trying to list markers for PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
- i = 0;
- while (cmsf[i].channel != NULL) {
- printf("{PID: %u, channel/marker: %s/%s, "
- "state: %u, fmt: %s}\n",
- (unsigned int) *pidit,
- cmsf[i].channel,
- cmsf[i].marker,
- cmsf[i].state,
- cmsf[i].fs);
- ++i;
- }
- ustcmd_free_cmsf(cmsf);
- break;
-
- case LIST_TRACE_EVENTS:
- tes = NULL;
- if (ustcmd_get_tes(&tes, *pidit)) {
- ERR("error while trying to list "
- "trace_events for PID %u\n",
- (unsigned int) *pidit);
- break;
- }
- i = 0;
- while (tes[i].name != NULL) {
- printf("{PID: %u, trace_event: %s}\n",
- (unsigned int) *pidit,
- tes[i].name);
- ++i;
- }
- ustcmd_free_tes(tes);
-
- break;
- case ENABLE_MARKER:
- if (opts.regex) {
- if (ustcmd_set_marker_state(opts.regex, 1, *pidit)) {
- ERR("error while trying to enable marker %s with PID %u\n",
- opts.regex, (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- }
- }
- break;
- case DISABLE_MARKER:
- if (opts.regex) {
- if (ustcmd_set_marker_state(opts.regex, 0, *pidit)) {
- ERR("error while trying to disable marker %s with PID %u\n",
- opts.regex, (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- }
- }
- break;
-
- case SET_SUBBUF_SIZE:
- if (opts.regex) {
- if (ustcmd_set_subbuf_size(opts.regex, *pidit)) {
- ERR("error while trying to set the size of subbuffers with PID %u\n",
- (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- }
- }
- break;
-
- case SET_SUBBUF_NUM:
- if (opts.regex) {
- if (ustcmd_set_subbuf_num(opts.regex, *pidit)) {
- ERR("error while trying to set the number of subbuffers with PID %u\n",
- (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- }
- }
- break;