* [lttng-dev] [PATCH lttng-tools 11/28] Add handling of LTTNG_ENABLE_EVENT_WITH_EXCLUSION
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 12/28] Collate handling of LTTNG_ENABLE_EVENT_WITH_FILTER JP Ikaheimonen
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Add handling of the command LTTNG_ENABLE_EVENT_WITH_EXCLUSION.
The handling of the command is the same as command LTTNG_ENABLE_EVENT,
as the new command is just an extension.
If the command data shows that exclusions and/or filter data will
be following the command structure, read those from the incoming
socket, then forward the filter and exclusion data to
cmd_enable_event().
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/main.c | 69 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 66 insertions(+), 3 deletions(-)
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 71e1a9b..ab7d49b 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -2930,10 +2930,73 @@ skip_domain:
break;
}
case LTTNG_ENABLE_EVENT:
+ case LTTNG_ENABLE_EVENT_WITH_EXCLUSION:
{
- ret = cmd_enable_event(cmd_ctx->session, &cmd_ctx->lsm->domain,
- cmd_ctx->lsm->u.enable.channel_name,
- &cmd_ctx->lsm->u.enable.event, NULL, NULL, kernel_poll_pipe[1]);
+ struct lttng_event_exclusion *exclusion = NULL;
+ struct lttng_filter_bytecode *bytecode = NULL;
+
+ if (cmd_ctx->lsm->cmd_type == LTTNG_ENABLE_EVENT ||
+ (cmd_ctx->lsm->u.enable.exclusion_count == 0 && cmd_ctx->lsm->u.enable.bytecode_len == 0)) {
+ ret = cmd_enable_event(cmd_ctx->session, &cmd_ctx->lsm->domain,
+ cmd_ctx->lsm->u.enable.channel_name,
+ &cmd_ctx->lsm->u.enable.event, NULL, NULL, kernel_poll_pipe[1]);
+ } else {
+ if (cmd_ctx->lsm->u.enable.exclusion_count != 0) {
+ exclusion = zmalloc(sizeof(struct lttng_event_exclusion) +
+ cmd_ctx->lsm->u.enable.exclusion_count * LTTNG_SYMBOL_NAME_LEN);
+ if (!exclusion) {
+ ret = LTTNG_ERR_EXCLUSION_NOMEM;
+ goto error;
+ }
+ DBG("Receiving var len data from client ...");
+ exclusion->count = cmd_ctx->lsm->u.enable.exclusion_count;
+ ret = lttcomm_recv_unix_sock(sock, exclusion->names,
+ cmd_ctx->lsm->u.enable.exclusion_count * LTTNG_SYMBOL_NAME_LEN);
+ if (ret <= 0) {
+ DBG("Nothing recv() from client var len data... continuing");
+ *sock_error = 1;
+ ret = LTTNG_ERR_EXCLUSION_INVAL;
+ goto error;
+ }
+ }
+ if (cmd_ctx->lsm->u.enable.bytecode_len != 0) {
+ bytecode = zmalloc(cmd_ctx->lsm->u.enable.bytecode_len);
+ if (!bytecode) {
+ if (!exclusion)
+ free(exclusion);
+ ret = LTTNG_ERR_FILTER_NOMEM;
+ goto error;
+ }
+ /* Receive var. len. data */
+ DBG("Receiving var len data from client ...");
+ ret = lttcomm_recv_unix_sock(sock, bytecode,
+ cmd_ctx->lsm->u.enable.bytecode_len);
+ if (ret <= 0) {
+ DBG("Nothing recv() from client car len data... continuing");
+ *sock_error = 1;
+ if (!exclusion)
+ free(exclusion);
+ ret = LTTNG_ERR_FILTER_INVAL;
+ goto error;
+ }
+
+ if (bytecode->len + sizeof(*bytecode)
+ != cmd_ctx->lsm->u.enable.bytecode_len) {
+ free(bytecode);
+ if (!exclusion)
+ free(exclusion);
+ ret = LTTNG_ERR_FILTER_INVAL;
+ goto error;
+ }
+ }
+
+ ret = cmd_enable_event(cmd_ctx->session,
+ &cmd_ctx->lsm->domain,
+ cmd_ctx->lsm->u.enable.channel_name,
+ &cmd_ctx->lsm->u.enable.event, bytecode,
+ exclusion,
+ kernel_poll_pipe[1]);
+ }
break;
}
case LTTNG_ENABLE_ALL_EVENT:
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 12/28] Collate handling of LTTNG_ENABLE_EVENT_WITH_FILTER
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 11/28] Add handling of LTTNG_ENABLE_EVENT_WITH_EXCLUSION JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 13/28] Add exclusion data to ust_app_event structure JP Ikaheimonen
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Because the handling of LTTNG_ENABLE_EVENT_WITH_EXCLUSION can
now handle commands of type LTTNG_ENABLE_EVENT_WITH_FILTER,
there's no reason to have the same code appear twice.
Remove the code for LTTNG_ENABLE_EVENT_WITH_FILTER and use the
same code as is used for LTTNG_ENABLE_EVENT_WITH_EXCLUSION.
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/main.c | 41 +----------------------------------------
1 file changed, 1 insertion(+), 40 deletions(-)
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index ab7d49b..7194fd5 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -2931,6 +2931,7 @@ skip_domain:
}
case LTTNG_ENABLE_EVENT:
case LTTNG_ENABLE_EVENT_WITH_EXCLUSION:
+ case LTTNG_ENABLE_EVENT_WITH_FILTER:
{
struct lttng_event_exclusion *exclusion = NULL;
struct lttng_filter_bytecode *bytecode = NULL;
@@ -3320,46 +3321,6 @@ skip_domain:
cmd_ctx->lsm->u.reg.path, cdata);
break;
}
- case LTTNG_ENABLE_EVENT_WITH_FILTER:
- {
- struct lttng_filter_bytecode *bytecode;
-
- if (cmd_ctx->lsm->u.enable.bytecode_len > LTTNG_FILTER_MAX_LEN) {
- ret = LTTNG_ERR_FILTER_INVAL;
- goto error;
- }
- if (cmd_ctx->lsm->u.enable.bytecode_len == 0) {
- ret = LTTNG_ERR_FILTER_INVAL;
- goto error;
- }
- bytecode = zmalloc(cmd_ctx->lsm->u.enable.bytecode_len);
- if (!bytecode) {
- ret = LTTNG_ERR_FILTER_NOMEM;
- goto error;
- }
- /* Receive var. len. data */
- DBG("Receiving var len data from client ...");
- ret = lttcomm_recv_unix_sock(sock, bytecode,
- cmd_ctx->lsm->u.enable.bytecode_len);
- if (ret <= 0) {
- DBG("Nothing recv() from client var len data... continuing");
- *sock_error = 1;
- ret = LTTNG_ERR_FILTER_INVAL;
- goto error;
- }
-
- if (bytecode->len + sizeof(*bytecode)
- != cmd_ctx->lsm->u.enable.bytecode_len) {
- free(bytecode);
- ret = LTTNG_ERR_FILTER_INVAL;
- goto error;
- }
-
- ret = cmd_enable_event(cmd_ctx->session, &cmd_ctx->lsm->domain,
- cmd_ctx->lsm->u.enable.channel_name,
- &cmd_ctx->lsm->u.enable.event, bytecode, NULL, kernel_poll_pipe[1]);
- break;
- }
case LTTNG_DATA_PENDING:
{
ret = cmd_data_pending(cmd_ctx->session);
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 13/28] Add exclusion data to ust_app_event structure
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 11/28] Add handling of LTTNG_ENABLE_EVENT_WITH_EXCLUSION JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 12/28] Collate handling of LTTNG_ENABLE_EVENT_WITH_FILTER JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 14/28] Compare also exclusions in ht_match_ust_app_event JP Ikaheimonen
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Add exclusion data to ust_app_event and ust_app_ht_key
data structures.
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h
index 680ab6f..2522557 100644
--- a/src/bin/lttng-sessiond/ust-app.h
+++ b/src/bin/lttng-sessiond/ust-app.h
@@ -50,6 +50,7 @@ struct ust_app_ht_key {
const char *name;
const struct lttng_ust_filter_bytecode *filter;
enum lttng_ust_loglevel_type loglevel;
+ const struct lttng_ust_event_exclusion *exclusion;
};
/*
@@ -115,6 +116,7 @@ struct ust_app_event {
char name[LTTNG_UST_SYM_NAME_LEN];
struct lttng_ht_node_str node;
struct lttng_ust_filter_bytecode *filter;
+ struct lttng_ust_event_exclusion *exclusion;
};
struct ust_app_stream {
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 14/28] Compare also exclusions in ht_match_ust_app_event
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
` (2 preceding siblings ...)
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 13/28] Add exclusion data to ust_app_event structure JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 15/28] Copy event exclusion data in add_unique_ust_app_event JP Ikaheimonen
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
In ht_match_ust_app_event, one of the matching criteria is
that the exclusions must match also. Add the code that checks if
exclusions match.
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 11b588f..cc611fc 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -104,7 +104,7 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
event = caa_container_of(node, struct ust_app_event, node.node);
key = _key;
- /* Match the 3 elements of the key: name, filter and loglevel. */
+ /* Match the 4 elements of the key: name, filter, loglevel, exclusions */
/* Event name */
if (strncmp(event->attr.name, key->name, sizeof(event->attr.name)) != 0) {
@@ -140,6 +140,21 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
}
}
+ /* One of the exclusions is NULL, fail. */
+ if ((key->exclusion && !event->exclusion) || (!key->exclusion && event->exclusion)) {
+ goto no_match;
+ }
+
+ if (key->exclusion && event->exclusion) {
+ /* Both exclusions exists, check count followed by the names. */
+ if (event->exclusion->count != key->exclusion->count ||
+ memcmp(event->exclusion->names, key->exclusion->names,
+ event->exclusion->count * LTTNG_UST_SYM_NAME_LEN) != 0) {
+ goto no_match;
+ }
+ }
+
+
/* Match. */
return 1;
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 15/28] Copy event exclusion data in add_unique_ust_app_event
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
` (3 preceding siblings ...)
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 14/28] Compare also exclusions in ht_match_ust_app_event JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 16/28] Free exclusion data when ust_app_event is deleted JP Ikaheimonen
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index cc611fc..2d8cb2c 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -181,6 +181,7 @@ static void add_unique_ust_app_event(struct ust_app_channel *ua_chan,
key.name = event->attr.name;
key.filter = event->filter;
key.loglevel = event->attr.loglevel;
+ key.exclusion = event->exclusion;
node_ptr = cds_lfht_add_unique(ht->ht,
ht->hash_fct(event->node.key, lttng_ht_seed),
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 16/28] Free exclusion data when ust_app_event is deleted
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
` (4 preceding siblings ...)
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 15/28] Copy event exclusion data in add_unique_ust_app_event JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 17/28] Add exclusion data to find_ust_app_event JP Ikaheimonen
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 2d8cb2c..9f9919e 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -287,7 +287,8 @@ void delete_ust_app_event(int sock, struct ust_app_event *ua_event)
assert(ua_event);
free(ua_event->filter);
-
+ if (ua_event->exclusion != NULL)
+ free(ua_event->exclusion);
if (ua_event->obj != NULL) {
ret = ustctl_release_object(sock, ua_event->obj);
if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 17/28] Add exclusion data to find_ust_app_event
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
` (5 preceding siblings ...)
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 16/28] Free exclusion data when ust_app_event is deleted JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 18/28] Copy exclusion data in shadow_copy_event JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 19/28] Set event exclusions in the target when event is created JP Ikaheimonen
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Add exclusion data to the prototype of find_ust_app_event
and to wherever it is called.
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 9f9919e..adb31e8 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -1022,7 +1022,8 @@ error:
* Return an ust_app_event object or NULL on error.
*/
static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
- char *name, struct lttng_ust_filter_bytecode *filter, int loglevel)
+ char *name, struct lttng_ust_filter_bytecode *filter, int loglevel,
+ const struct lttng_event_exclusion *exclusion)
{
struct lttng_ht_iter iter;
struct lttng_ht_node_str *node;
@@ -1036,6 +1037,8 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
key.name = name;
key.filter = filter;
key.loglevel = loglevel;
+ /* lttng_event_exclusion and lttng_ust_event_exclusion structures are similar */
+ key.exclusion = (struct lttng_ust_event_exclusion *)exclusion;
/* Lookup using the event name as hash and a custom match fct. */
cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
@@ -1471,7 +1474,7 @@ static void shadow_copy_channel(struct ust_app_channel *ua_chan,
/* Copy all events from ltt ust channel to ust app channel */
cds_lfht_for_each_entry(uchan->events->ht, &iter.iter, uevent, node.node) {
ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
- uevent->filter, uevent->attr.loglevel);
+ uevent->filter, uevent->attr.loglevel, uevent->exclusion);
if (ua_event == NULL) {
DBG2("UST event %s not found on shadow copy channel",
uevent->attr.name);
@@ -2584,7 +2587,7 @@ int create_ust_app_event(struct ust_app_session *ua_sess,
/* Get event node */
ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
- uevent->filter, uevent->attr.loglevel);
+ uevent->filter, uevent->attr.loglevel, uevent->exclusion);
if (ua_event != NULL) {
ret = -EEXIST;
goto end;
@@ -3642,7 +3645,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
/* Get event node */
ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
- uevent->filter, uevent->attr.loglevel);
+ uevent->filter, uevent->attr.loglevel, uevent->exclusion);
if (ua_event == NULL) {
DBG3("UST app enable event %s not found for app PID %d."
"Skipping app", uevent->attr.name, app->pid);
@@ -4368,7 +4371,7 @@ int ust_app_enable_event_pid(struct ltt_ust_session *usess,
ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
- uevent->filter, uevent->attr.loglevel);
+ uevent->filter, uevent->attr.loglevel, uevent->exclusion);
if (ua_event == NULL) {
ret = create_ust_app_event(ua_sess, ua_chan, uevent, app);
if (ret < 0) {
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 18/28] Copy exclusion data in shadow_copy_event
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
` (6 preceding siblings ...)
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 17/28] Add exclusion data to find_ust_app_event JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 19/28] Set event exclusions in the target when event is created JP Ikaheimonen
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index adb31e8..255a41b 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -1410,6 +1410,8 @@ error:
static void shadow_copy_event(struct ust_app_event *ua_event,
struct ltt_ust_event *uevent)
{
+ size_t exclusion_alloc_size;
+
strncpy(ua_event->name, uevent->attr.name, sizeof(ua_event->name));
ua_event->name[sizeof(ua_event->name) - 1] = '\0';
@@ -1423,6 +1425,16 @@ static void shadow_copy_event(struct ust_app_event *ua_event,
ua_event->filter = alloc_copy_ust_app_filter(uevent->filter);
/* Filter might be NULL here in case of ENONEM. */
}
+
+ /* Copy exclusion data */
+ if (uevent->exclusion) {
+ exclusion_alloc_size = sizeof(struct lttng_ust_event_exclusion) +
+ LTTNG_UST_SYM_NAME_LEN * uevent->exclusion->count;
+ ua_event->exclusion = zmalloc(exclusion_alloc_size);
+ if (ua_event->exclusion) {
+ memcpy(ua_event->exclusion, uevent->exclusion, exclusion_alloc_size);
+ }
+ }
}
/*
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread* [lttng-dev] [PATCH lttng-tools 19/28] Set event exclusions in the target when event is created
2013-11-07 10:21 [lttng-dev] [PATCH lttng-tools 10/28] Add new error codes for exclusion processing JP Ikaheimonen
` (7 preceding siblings ...)
2013-11-07 10:21 ` [lttng-dev] [PATCH lttng-tools 18/28] Copy exclusion data in shadow_copy_event JP Ikaheimonen
@ 2013-11-07 10:21 ` JP Ikaheimonen
8 siblings, 0 replies; 10+ messages in thread
From: JP Ikaheimonen @ 2013-11-07 10:21 UTC (permalink / raw)
Add a new function set_ust_event_exclusion() that calls the target-side
function that sets the exclusions to an event and reports possible errors.
Call set_ust_event_exclusion() in create_ust_event().
Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
src/bin/lttng-sessiond/ust-app.c | 49 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 255a41b..d8adccd 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -1137,6 +1137,47 @@ error:
}
/*
+ * Set event exclusions on the tracer.
+ */
+static
+int set_ust_event_exclusion(struct ust_app_event *ua_event,
+ struct ust_app *app)
+{
+ int ret;
+
+ health_code_update();
+
+ if (!ua_event->exclusion || !ua_event->exclusion->count) {
+ ret = 0;
+ goto error;
+ }
+
+ ret = ustctl_set_exclusion(app->sock, ua_event->exclusion,
+ ua_event->obj);
+ if (ret < 0) {
+ if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
+ ERR("UST app event %s exclusions failed for app (pid: %d) "
+ "with ret %d", ua_event->attr.name, app->pid, ret);
+ } else {
+ /*
+ * This is normal behavior, an application can die during the
+ * creation process. Don't report an error so the execution can
+ * continue normally.
+ */
+ ret = 0;
+ DBG3("UST app event exclusion failed. Application is dead.");
+ }
+ goto error;
+ }
+
+ DBG2("UST exclusion set successfully for event %s", ua_event->name);
+
+error:
+ health_code_update();
+ return ret;
+}
+
+/*
* Disable the specified event on to UST tracer for the UST session.
*/
static int disable_ust_event(struct ust_app *app,
@@ -1375,6 +1416,14 @@ int create_ust_event(struct ust_app *app, struct ust_app_session *ua_sess,
}
}
+ /* Set exclusions for the event */
+ if (ua_event->exclusion) {
+ ret = set_ust_event_exclusion(ua_event, app);
+ if (ret < 0) {
+ goto error;
+ }
+ }
+
/* If event not enabled, disable it on the tracer */
if (ua_event->enabled == 0) {
ret = disable_ust_event(app, ua_sess, ua_event);
--
1.8.1.2
^ permalink raw reply [flat|nested] 10+ messages in thread