Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jp_ikaheimonen@mentor.com (JP Ikaheimonen)
Subject: [lttng-dev] [PATCH lttng-tools 19/28] Set event exclusions in the target when event is created
Date: Thu,  7 Nov 2013 12:21:43 +0200	[thread overview]
Message-ID: <1383819703-6793-10-git-send-email-jp_ikaheimonen@mentor.com> (raw)
In-Reply-To: <1383819703-6793-1-git-send-email-jp_ikaheimonen@mentor.com>

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




      parent reply	other threads:[~2013-11-07 10:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` [lttng-dev] [PATCH lttng-tools 13/28] Add exclusion data to ust_app_event structure 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
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 ` [lttng-dev] [PATCH lttng-tools 16/28] Free exclusion data when ust_app_event is deleted JP Ikaheimonen
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 ` [lttng-dev] [PATCH lttng-tools 18/28] Copy exclusion data in shadow_copy_event JP Ikaheimonen
2013-11-07 10:21 ` JP Ikaheimonen [this message]

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=1383819703-6793-10-git-send-email-jp_ikaheimonen@mentor.com \
    --to=jp_ikaheimonen@mentor.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