lttng: list: replace domain headers with the official names
[lttng-tools.git] / src / bin / lttng / commands / list.c
index 49470ab86b91d00fc8032f5062b8b89429599ad0..334d4daf1f6bf02d8d77084e10d8ccbdacddfc53 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #define _LGPL_SOURCE
@@ -1539,16 +1529,29 @@ static int list_tracker_ids(enum lttng_tracker_type tracker_type)
 {
        int ret = 0;
        int enabled = 1;
-       struct lttng_tracker_id **ids = NULL;
-       size_t nr_ids, i;
+       struct lttng_tracker_ids *ids = NULL;
+       unsigned int nr_ids, i;
+       const struct lttng_tracker_id *id;
+       enum lttng_tracker_id_status status;
 
-       ret = lttng_list_tracker_ids(handle, tracker_type, &ids, &nr_ids);
+       ret = lttng_list_tracker_ids(handle, tracker_type, &ids);
        if (ret) {
                return ret;
        }
-       if (nr_ids == 1 && lttng_tracker_id_get_type(ids[0]) == LTTNG_ID_ALL) {
-               enabled = 0;
+
+       status = lttng_tracker_ids_get_count(ids, &nr_ids);
+       if (status != LTTNG_TRACKER_ID_STATUS_OK) {
+               ret = CMD_ERROR;
+               goto end;
+       }
+
+       if (nr_ids == 1) {
+               id = lttng_tracker_ids_get_at_index(ids, 0);
+               if (id && lttng_tracker_id_get_type(id) == LTTNG_ID_ALL) {
+                       enabled = 0;
+               }
        }
+
        if (enabled) {
                _MSG("%s tracker: [", get_tracker_str(tracker_type));
 
@@ -1562,11 +1565,17 @@ static int list_tracker_ids(enum lttng_tracker_type tracker_type)
                }
 
                for (i = 0; i < nr_ids; i++) {
-                       struct lttng_tracker_id *id = ids[i];
-                       enum lttng_tracker_id_status status;
+                       enum lttng_tracker_id_status status =
+                                       LTTNG_TRACKER_ID_STATUS_OK;
                        int value;
                        const char *value_string;
 
+                       id = lttng_tracker_ids_get_at_index(ids, i);
+                       if (!id) {
+                               ret = CMD_ERROR;
+                               goto end;
+                       }
+
                        switch (lttng_tracker_id_get_type(id)) {
                        case LTTNG_ID_ALL:
                                break;
@@ -1627,7 +1636,7 @@ static int list_tracker_ids(enum lttng_tracker_type tracker_type)
                }
        }
 end:
-       lttng_tracker_ids_destroy(ids, nr_ids);
+       lttng_tracker_ids_destroy(ids);
        return ret;
 }
 
@@ -2335,22 +2344,22 @@ int cmd_list(int argc, const char **argv)
                        for (i = 0; i < nb_domain; i++) {
                                switch (domains[i].type) {
                                case LTTNG_DOMAIN_KERNEL:
-                                       MSG("=== Domain: Kernel ===\n");
+                                       MSG("=== Domain: Linux kernel ===\n");
                                        break;
                                case LTTNG_DOMAIN_UST:
-                                       MSG("=== Domain: UST global ===\n");
-                                       MSG("Buffer type: %s\n",
+                                       MSG("=== Domain: User space ===\n");
+                                       MSG("Buffering scheme: %s\n",
                                                        domains[i].buf_type ==
-                                                       LTTNG_BUFFER_PER_PID ? "per PID" : "per UID");
+                                                       LTTNG_BUFFER_PER_PID ? "per-process" : "per-user");
                                        break;
                                case LTTNG_DOMAIN_JUL:
-                                       MSG("=== Domain: JUL (Java Util Logging) ===\n");
+                                       MSG("=== Domain: java.util.logging (JUL) ===\n");
                                        break;
                                case LTTNG_DOMAIN_LOG4J:
-                                       MSG("=== Domain: LOG4j (Logging for Java) ===\n");
+                                       MSG("=== Domain: log4j ===\n");
                                        break;
                                case LTTNG_DOMAIN_PYTHON:
-                                       MSG("=== Domain: Python (logging) ===\n");
+                                       MSG("=== Domain: Python logging ===\n");
                                        break;
                                default:
                                        MSG("=== Domain: Unimplemented ===\n");
This page took 0.025057 seconds and 4 git commands to generate.