Implement ustctl_tracepoint_list/list_get
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 9 Nov 2011 15:25:31 +0000 (10:25 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 9 Nov 2011 15:25:31 +0000 (10:25 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-comm.h
include/lttng/ust-ctl.h
liblttng-ust-ctl/ustctl.c
liblttng-ust/lttng-ust-abi.c
liblttng-ust/lttng-ust-comm.c

index 556da21e130570d543a1c6ab358e227917327a9d..f5da9559000e9f3dcc502daddbd43deaf236a283 100644 (file)
@@ -150,6 +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];
        } u;
 };
 
index 17105631d8a0e33b50d8d08e05118f16313fccda..2bb03f65561248da62176326530944fd6147c7e9 100644 (file)
@@ -44,7 +44,18 @@ int ustctl_disable(int sock, struct lttng_ust_object_data *object);
 int ustctl_start_session(int sock, int handle);
 int ustctl_stop_session(int sock, int handle);
 
-int ustctl_tracepoint_list(int sock);  /* not implemented yet */
+/*
+ * ustctl_tracepoint_list returns a tracepoint list handle, or negative
+ * error value.
+ */
+int ustctl_tracepoint_list(int sock);
+/*
+ * ustctl_tracepoint_list_get is used to iterate on the tp list
+ * handle. End is iteration is reached when -ENOENT is returned.
+ */
+int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
+               char iter[LTTNG_UST_SYM_NAME_LEN]);
+
 int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v);
 int ustctl_wait_quiescent(int sock);
 
index b4234effc01212bb43f4150716429364a4f340e4..f9c5e84fab59ef65116b70aa7d8df1941a123027 100644 (file)
@@ -370,10 +370,39 @@ int ustctl_stop_session(int sock, int handle)
        return ustctl_disable(sock, &obj);
 }
 
-
 int ustctl_tracepoint_list(int sock)
 {
-       return -ENOSYS; /* not implemented */
+       struct ustcomm_ust_msg lum;
+       struct ustcomm_ust_reply lur;
+       int ret, tp_list_handle;
+
+       memset(&lum, 0, sizeof(lum));
+       lum.handle = LTTNG_UST_ROOT_HANDLE;
+       lum.cmd = LTTNG_UST_TRACEPOINT_LIST;
+       ret = ustcomm_send_app_cmd(sock, &lum, &lur);
+       if (ret)
+               return ret;
+       tp_list_handle = lur.ret_val;
+       DBG("received tracepoint list handle %u", tp_list_handle);
+       return tp_list_handle;
+}
+
+int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
+               char iter[LTTNG_UST_SYM_NAME_LEN])
+{
+       struct ustcomm_ust_msg lum;
+       struct ustcomm_ust_reply lur;
+       int ret;
+
+       memset(&lum, 0, sizeof(lum));
+       lum.handle = tp_list_handle;
+       lum.cmd = LTTNG_UST_TRACEPOINT_LIST_GET;
+       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, lur.u.tracepoint_list_entry, LTTNG_UST_SYM_NAME_LEN);
+       return 0;
 }
 
 int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v)
index 4b8a8e71d9e5b4548f8e3e3d2c0e7e676e514c96..ccdfcfad83bb8f5ab3f7c611bb6178ed63ff179a 100644 (file)
@@ -523,10 +523,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;
 
        switch (cmd) {
        case LTTNG_UST_TRACEPOINT_LIST_GET:
-               ltt_tracepoint_list_get(list, (char *) arg);
+               ltt_tracepoint_list_get(list, str);
+               if (str[0] == '\0')
+                       return -ENOENT;
                return 0;
        default:
                return -EINVAL;
index ad02dd9d366faaf043f9b13bc638eef371b99a4a..71bf716a3ab263e6ee34b5443f64e7ece712be41 100644 (file)
@@ -304,6 +304,11 @@ end:
        case LTTNG_UST_VERSION:
                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);
+               break;
        }
        ret = send_reply(sock, &lur);
        if (ret < 0) {
This page took 0.029326 seconds and 4 git commands to generate.