From cbef69018acdeb52d27529e80126b43f3733e233 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 30 Nov 2011 18:44:20 -0500 Subject: [PATCH] Change API to support exporting loglevel in event listing Signed-off-by: Mathieu Desnoyers --- include/lttng/ust-abi.h | 6 ++++++ include/lttng/ust-ctl.h | 8 +------- include/ust-comm.h | 4 ++-- liblttng-ust-ctl/ustctl.c | 9 ++++++--- liblttng-ust/lttng-ust-abi.c | 27 +++++++++++++++++++++------ liblttng-ust/lttng-ust-comm.c | 4 +--- 6 files changed, 37 insertions(+), 21 deletions(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index f5dd2665..2567ceb8 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -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; diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index 0945e4ef..1ff34b9a 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -22,12 +22,6 @@ #include -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); diff --git a/include/ust-comm.h b/include/ust-comm.h index deb0438b..4c360dcc 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -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; }; diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 6a902ef8..b612d2ce 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -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; } diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index e6ffa41f..d146e102 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -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: diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 33651000..6830d86d 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -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); -- 2.34.1