Change API to support exporting loglevel in event listing
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 30 Nov 2011 23:44:20 +0000 (18:44 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 30 Nov 2011 23:44:20 +0000 (18:44 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-abi.h
include/lttng/ust-ctl.h
include/ust-comm.h
liblttng-ust-ctl/ustctl.c
liblttng-ust/lttng-ust-abi.c
liblttng-ust/lttng-ust-comm.c

index f5dd2665dca244fc0529a1e3d49ecb98433a75f7..2567ceb8a7e179e89e0673a5b6565478956511f9 100644 (file)
@@ -98,6 +98,12 @@ struct lttng_ust_channel_attr {
        enum lttng_ust_output output;           /* splice, mmap */
 };
 
+struct lttng_ust_tracepoint_iter {
+       char name[LTTNG_UST_SYM_NAME_LEN];      /* provider:name */
+       char loglevel[LTTNG_UST_SYM_NAME_LEN];  /* loglevel */
+       int64_t loglevel_value;
+};
+
 struct lttng_ust_object_data {
        int handle;
        int shm_fd;
index 0945e4ef6765d949dd20a1222a59a9af505b98bb..1ff34b9a61afeaf8f16a623019d976b2f12328f4 100644 (file)
 
 #include <lttng/ust-abi.h>
 
-struct ustctl_tracepoint_iter {
-       char name[LTTNG_UST_SYM_NAME_LEN];      /* provider:name */
-       char loglevel[LTTNG_UST_SYM_NAME_LEN];  /* provider:loglevel */
-       int64_t loglevel_value;
-};
-
 int ustctl_register_done(int sock);
 int ustctl_create_session(int sock);
 int ustctl_open_metadata(int sock, int session_handle,
@@ -60,7 +54,7 @@ int ustctl_tracepoint_list(int sock);
  * handle. End is iteration is reached when -ENOENT is returned.
  */
 int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
-               struct ustctl_tracepoint_iter *iter);
+               struct lttng_ust_tracepoint_iter *iter);
 
 int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v);
 int ustctl_wait_quiescent(int sock);
index deb0438bedd577179196c803dc7316243bcb7f53..4c360dcc81316d10df40dc5eb8c5e6993344f7f6 100644 (file)
@@ -129,7 +129,7 @@ struct ustcomm_ust_msg {
                struct lttng_ust_event event;
                struct lttng_ust_context context;
                struct lttng_ust_tracer_version version;
-               char tracepoint_list_entry[LTTNG_UST_SYM_NAME_LEN];
+               struct lttng_ust_tracepoint_iter tracepoint;
        } u;
 };
 
@@ -150,7 +150,7 @@ struct ustcomm_ust_reply {
                        uint64_t memory_map_size;
                } stream;
                struct lttng_ust_tracer_version version;
-               char tracepoint_list_entry[LTTNG_UST_SYM_NAME_LEN];
+               struct lttng_ust_tracepoint_iter tracepoint;
        } u;
 };
 
index 6a902ef8f9885bd27d9f30b0b2b9c82907c55ea7..b612d2ce6e5819c4160bd4022cd20c366c082e4d 100644 (file)
@@ -408,7 +408,7 @@ int ustctl_tracepoint_list(int sock)
 }
 
 int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
-               struct ustctl_tracepoint_iter *iter)
+               struct lttng_ust_tracepoint_iter *iter)
 {
        struct ustcomm_ust_msg lum;
        struct ustcomm_ust_reply lur;
@@ -420,8 +420,11 @@ int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
        ret = ustcomm_send_app_cmd(sock, &lum, &lur);
        if (ret)
                return ret;
-       DBG("received tracepoint list entry %s", lur.u.tracepoint_list_entry);
-       memcpy(iter->name, lur.u.tracepoint_list_entry, LTTNG_UST_SYM_NAME_LEN);
+       DBG("received tracepoint list entry name %s loglevel %s loglevel_value %lld",
+               lur.u.tracepoint.name,
+               lur.u.tracepoint.loglevel,
+               (unsigned long long) lur.u.tracepoint.loglevel_value);
+       memcpy(iter, &lur.u.tracepoint, sizeof(*iter));
        return 0;
 }
 
index e6ffa41f071e2f50a40ab826ab577ba2674ca4bf..d146e1023efda3c70ee21db5be17a61d63070dc5 100644 (file)
@@ -510,7 +510,7 @@ static const struct lttng_ust_objd_ops lttng_session_ops = {
  */
 static
 void ltt_tracepoint_list_get(struct ltt_tracepoint_list *list,
-               char *tp_list_entry)
+               struct lttng_ust_tracepoint_iter *tracepoint)
 {
 next:
        if (!list->got_first) {
@@ -521,13 +521,27 @@ next:
        tracepoint_iter_next(&list->iter);
 copy:
        if (!list->iter.tracepoint) {
-               tp_list_entry[0] = '\0';        /* end of list */
+               tracepoint->name[0] = '\0';     /* end of list */
        } else {
                if (!strcmp((*list->iter.tracepoint)->name,
                                "lttng_ust:metadata"))
                        goto next;
-               memcpy(tp_list_entry, (*list->iter.tracepoint)->name,
+               memcpy(tracepoint->name, (*list->iter.tracepoint)->name,
                        LTTNG_UST_SYM_NAME_LEN);
+#if 0
+               if ((*list->iter.tracepoint)->loglevel) {
+                       memcpy(tracepoint->loglevel,
+                               (*list->iter.tracepoint)->loglevel->identifier,
+                               LTTNG_UST_SYM_NAME_LEN);
+                       tracepoint->loglevel_value =
+                               (*list->iter.tracepoint)->loglevel->value;
+               } else {
+#endif
+                       tracepoint->loglevel[0] = '\0';
+                       tracepoint->loglevel_value = 0;
+#if 0
+               }
+#endif
        }
 }
 
@@ -535,12 +549,13 @@ static
 long lttng_tracepoint_list_cmd(int objd, unsigned int cmd, unsigned long arg)
 {
        struct ltt_tracepoint_list *list = objd_private(objd);
-       char *str = (char *) arg;
+       struct lttng_ust_tracepoint_iter *tp =
+               (struct lttng_ust_tracepoint_iter *) arg;
 
        switch (cmd) {
        case LTTNG_UST_TRACEPOINT_LIST_GET:
-               ltt_tracepoint_list_get(list, str);
-               if (str[0] == '\0')
+               ltt_tracepoint_list_get(list, tp);
+               if (tp->name[0] == '\0')
                        return -ENOENT;
                return 0;
        default:
index 336510003a01006afb722cab4dbb056d89976fbd..6830d86d100ac4ad4e49b5458f2518b463d609cc 100644 (file)
@@ -307,9 +307,7 @@ end:
                lur.u.version = lum->u.version;
                break;
        case LTTNG_UST_TRACEPOINT_LIST_GET:
-               memcpy(lur.u.tracepoint_list_entry,
-                       lum->u.tracepoint_list_entry,
-                       LTTNG_UST_SYM_NAME_LEN);
+               memcpy(&lur.u.tracepoint, &lum->u.tracepoint, sizeof(lur.u.tracepoint));
                break;
        }
        ret = send_reply(sock, &lur);
This page took 0.029158 seconds and 4 git commands to generate.