- pidit = opts.pids;
- struct marker_status *cmsf = NULL;
-
- 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;
- }
- unsigned int 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 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;
-
- case GET_SUBBUF_SIZE:
- result = ustcmd_get_subbuf_size(opts.regex, *pidit);
- if (result == -1) {
- ERR("error while trying to get_subuf_size with PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
-
- printf("the size of subbufers is %d\n", result);
- break;
-
- case GET_SUBBUF_NUM:
- result = ustcmd_get_subbuf_num(opts.regex, *pidit);
- if (result == -1) {
- ERR("error while trying to get_subuf_num with PID %u\n", (unsigned int) *pidit);
- retval = EXIT_FAILURE;
- break;
- }
-
- printf("the number of subbufers is %d\n", result);
- break;