From: ylamarre@efficios.com (Yannick Lamarre)
Subject: [lttng-dev] [RFC PATCH lttng-tools 15/18] Integrate serialized communication in lttng-ctl and sessiond
Date: Thu, 18 Apr 2019 12:18:47 -0400 [thread overview]
Message-ID: <20190418161850.1536-16-ylamarre@efficios.com> (raw)
In-Reply-To: <20190418161850.1536-1-ylamarre@efficios.com>
lttng-ctl and lttng-sessiond use serialized communication for
messages using lttng_event.
Signed-off-by: Yannick Lamarre <ylamarre at efficios.com>
---
src/bin/lttng-sessiond/client.c | 23 ++++++++++++++++++++---
src/common/sessiond-comm/sessiond-comm.h | 4 ++--
src/lib/lttng-ctl/lttng-ctl.c | 14 ++++++++++----
3 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c
index 24e688c5..aed415ee 100644
--- a/src/bin/lttng-sessiond/client.c
+++ b/src/bin/lttng-sessiond/client.c
@@ -1150,6 +1150,7 @@ error_add_context:
case LTTNG_DISABLE_EVENT:
{
+ struct lttng_event event;
/*
* FIXME: handle filter; for now we just receive the filter's
* bytecode along with the filter expression which are sent by
@@ -1176,10 +1177,17 @@ error_add_context:
count -= (size_t) ret;
}
}
- /* FIXME: passing packed structure to non-packed pointer */
+ lttng_event_no_attr_deserialize(&event, &cmd_ctx->lsm->u.disable.event);
+ if (cmd_ctx->lsm->domain.type == LTTNG_DOMAIN_KERNEL) {
+ if (event.type == LTTNG_EVENT_PROBE || event.type == LTTNG_EVENT_FUNCTION || event.type == LTTNG_EVENT_USERSPACE_PROBE) {
+ lttng_event_probe_attr_deserialize(&event, &cmd_ctx->lsm->u.disable.event);
+ } else if (event.type == LTTNG_EVENT_FUNCTION_ENTRY) {
+ lttng_event_function_attr_deserialize(&event, &cmd_ctx->lsm->u.disable.event);
+ }
+ }
ret = cmd_disable_event(cmd_ctx->session, cmd_ctx->lsm->domain.type,
cmd_ctx->lsm->u.disable.channel_name,
- &cmd_ctx->lsm->u.disable.event);
+ &event);
break;
}
case LTTNG_ENABLE_CHANNEL:
@@ -1210,6 +1218,7 @@ error_add_context:
}
case LTTNG_ENABLE_EVENT:
{
+ struct lttng_event event;
struct lttng_event *ev = NULL;
struct lttng_event_exclusion *exclusion = NULL;
struct lttng_filter_bytecode *bytecode = NULL;
@@ -1312,7 +1321,15 @@ error_add_context:
}
}
- ev = lttng_event_copy(&cmd_ctx->lsm->u.enable.event);
+ lttng_event_no_attr_deserialize(&event, &cmd_ctx->lsm->u.disable.event);
+ if (cmd_ctx->lsm->domain.type == LTTNG_DOMAIN_KERNEL) {
+ if (event.type == LTTNG_EVENT_PROBE || event.type == LTTNG_EVENT_FUNCTION || event.type == LTTNG_EVENT_USERSPACE_PROBE) {
+ lttng_event_probe_attr_deserialize(&event, &cmd_ctx->lsm->u.disable.event);
+ } else if (event.type == LTTNG_EVENT_FUNCTION_ENTRY) {
+ lttng_event_function_attr_deserialize(&event, &cmd_ctx->lsm->u.disable.event);
+ }
+ }
+ ev = lttng_event_copy(&event);
if (!ev) {
DBG("Failed to copy event: %s",
cmd_ctx->lsm->u.enable.event.name);
diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h
index 78b18185..4c2240a0 100644
--- a/src/common/sessiond-comm/sessiond-comm.h
+++ b/src/common/sessiond-comm/sessiond-comm.h
@@ -370,7 +370,7 @@ struct lttcomm_session_msg {
/* Event data */
struct {
char channel_name[LTTNG_SYMBOL_NAME_LEN];
- struct lttng_event event LTTNG_PACKED;
+ struct lttng_event_serialized event;
/* Length of following filter expression. */
uint32_t expression_len;
/* Length of following bytecode for filter. */
@@ -389,7 +389,7 @@ struct lttcomm_session_msg {
} LTTNG_PACKED enable;
struct {
char channel_name[LTTNG_SYMBOL_NAME_LEN];
- struct lttng_event event LTTNG_PACKED;
+ struct lttng_event_serialized event;
/* Length of following filter expression. */
uint32_t expression_len;
/* Length of following bytecode for filter. */
diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c
index 686a98ef..a9adb5c2 100644
--- a/src/lib/lttng-ctl/lttng-ctl.c
+++ b/src/lib/lttng-ctl/lttng-ctl.c
@@ -1110,8 +1110,15 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
}
lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
- /* FIXME: copying non-packed struct to packed struct. */
- memcpy(&lsm.u.enable.event, ev, sizeof(lsm.u.enable.event));
+
+ lttng_event_no_attr_serialize(&lsm.u.enable.event, ev);
+ if (handle->domain.type == LTTNG_DOMAIN_KERNEL) {
+ if (ev->type == LTTNG_EVENT_PROBE || ev->type == LTTNG_EVENT_FUNCTION || ev->type == LTTNG_EVENT_USERSPACE_PROBE) {
+ lttng_event_probe_attr_serialize(&lsm.u.enable.event, ev);
+ } else if (ev->type == LTTNG_EVENT_FUNCTION_ENTRY) {
+ lttng_event_function_attr_serialize(&lsm.u.enable.event, ev);
+ }
+ }
lttng_ctl_copy_string(lsm.session.name, handle->session_name,
sizeof(lsm.session.name));
@@ -1310,8 +1317,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
lsm.cmd_type = LTTNG_DISABLE_EVENT;
lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
- /* FIXME: copying non-packed struct to packed struct. */
- memcpy(&lsm.u.disable.event, ev, sizeof(lsm.u.disable.event));
+ lttng_event_no_attr_serialize(&lsm.u.disable.event, ev);
lttng_ctl_copy_string(lsm.session.name, handle->session_name,
sizeof(lsm.session.name));
--
2.11.0
next prev parent reply other threads:[~2019-04-18 16:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 16:18 [lttng-dev] [RFC PATCH lttng-tools 00/18] Improvements in sessiond-comm Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 01/18] Fix: Use platform-independant types in sessiond to consumerd communication Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 02/18] Clean-up: Switch enum fields in lttcomm_consumer_msg Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 03/18] Clean-up: Switch enum fields in lttcomm_consumer_status_msg Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 04/18] Clean-up: Switch enum fields in lttcomm_consumer_status_channel Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 05/18] Clean-up: Remove unused structure Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 06/18] Clean-up: Removed deprecated field Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 07/18] Add serialized versions of lttng_channel structs Yannick Lamarre
2019-04-18 19:38 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 08/18] Add serdes functions for lttng_channel Yannick Lamarre
2019-04-18 19:32 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 09/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 10/18] Add serialized versions of lttng_event_context structs Yannick Lamarre
2019-04-18 19:41 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 11/18] Add serdes functions for lttng_event_context Yannick Lamarre
2019-04-18 19:42 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 12/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 19:44 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 13/18] Add serialized versions of lttng_event structs Yannick Lamarre
2019-04-18 19:45 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 14/18] Add serdes functions for lttng_event_context Yannick Lamarre
2019-04-18 19:46 ` Mathieu Desnoyers
2019-04-18 16:18 ` Yannick Lamarre [this message]
2019-04-18 19:49 ` [lttng-dev] [RFC PATCH lttng-tools 15/18] Integrate serialized communication in lttng-ctl and sessiond Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 16/18] Add serialized versions of lttng_event structs Yannick Lamarre
2019-04-18 19:50 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 17/18] Add serdes functions for lttng_snapshot_output Yannick Lamarre
2019-04-18 19:52 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 18/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 19:58 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190418161850.1536-16-ylamarre@efficios.com \
--to=ylamarre@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox