summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--runtime/ChangeLog11
-rw-r--r--runtime/task_finder.c30
-rw-r--r--tapsets.cxx7
4 files changed, 44 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index cb786d0e..806fcfa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,12 @@
* tapset/ppc64/registers.stp: Support powerpc register + arg lookup
* stapfuncs.5.in: Add powerpc bits; indicate scope of uarg_* access
+2008-05-21 David Smith <dsmith@redhat.com>:ChangeLog
+
+ * tapsets.cxx (utrace_derived_probe_group::emit_module_decls):
+ Added new 'event_flag' parameter to task_finder callback. Only
+ calls probe handlers if we received the correct event.
+
2008-05-20 Frank Ch. Eigler <fche@elastic.org>
PR 6538
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 3d506a18..0b7559b9 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -6,6 +6,17 @@
facilites (controlled by autoconf).
* autoconf-probe-kernel.c: test for above.
+2008-05-21 David Smith <dsmith@redhat.com>
+
+ * task_finder.c (__stp_utrace_attach_match_filename): Added
+ event_flag parameter of event to pass to callback.
+ (__stp_utrace_task_finder_target_death): Ditto.
+ (__stp_utrace_task_finder_report_clone): Calls
+ __stp_utrace_attach_match_filename() with new argument.
+ (__stp_utrace_task_finder_report_exec): Ditto.
+ (stap_start_task_finder): Calls callback with an invalid
+ event_flag since this callback call isn't related to an event.
+
2008-05-16 David Smith <dsmith@redhat.com>
PR 6499.
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index e78caab6..a8de13d0 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -13,6 +13,7 @@ atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING);
typedef int (*stap_task_finder_callback)(struct task_struct *tsk,
int register_p,
+ unsigned long event_flag,
struct stap_task_finder_target *tgt);
struct stap_task_finder_target {
@@ -237,7 +238,8 @@ __stp_utrace_attach(struct task_struct *tsk,
static inline void
__stp_utrace_attach_match_filename(struct task_struct *tsk,
- const char * const filename)
+ const char * const filename,
+ unsigned long event_flag)
{
size_t filelen;
struct list_head *tgt_node;
@@ -270,9 +272,10 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
continue;
if (cb_tgt->callback != NULL) {
- int rc = cb_tgt->callback(tsk, 1, cb_tgt);
+ int rc = cb_tgt->callback(tsk, 1, event_flag,
+ cb_tgt);
if (rc != 0) {
- _stp_error("exec callback for %d failed: %d",
+ _stp_error("callback for %d failed: %d",
(int)tsk->pid, rc);
break;
}
@@ -332,7 +335,8 @@ __stp_utrace_task_finder_report_clone(struct utrace_attached_engine *engine,
rc, (int)child->pid);
}
else {
- __stp_utrace_attach_match_filename(child, mmpath);
+ __stp_utrace_attach_match_filename(child, mmpath,
+ UTRACE_EVENT(CLONE));
}
_stp_kfree(mmpath_buf);
@@ -357,7 +361,8 @@ __stp_utrace_task_finder_report_exec(struct utrace_attached_engine *engine,
if (bprm->filename == NULL)
return UTRACE_ACTION_RESUME;
- __stp_utrace_attach_match_filename(tsk, bprm->filename);
+ __stp_utrace_attach_match_filename(tsk, bprm->filename,
+ UTRACE_EVENT(EXEC));
return UTRACE_ACTION_RESUME;
}
@@ -392,7 +397,7 @@ __stp_utrace_task_finder_target_death(struct utrace_attached_engine *engine,
int rc;
// Call the callback
- rc = tgt->callback(tsk, 0, tgt);
+ rc = tgt->callback(tsk, 0, UTRACE_EVENT(DEATH), tgt);
if (rc != 0) {
_stp_error("death callback for %d failed: %d",
(int)tsk->pid, rc);
@@ -485,8 +490,17 @@ stap_start_task_finder(void)
if (cb_tgt == NULL || cb_tgt->callback == NULL)
continue;
- // Call the callback.
- rc = cb_tgt->callback(tsk, 1, cb_tgt);
+ // Call the callback. Notice we're
+ // not passing a valid event_flag
+ // here. That's OK, for 2 reasons.
+ // (1) We're not in the
+ // STAP_SESSION_RUNNING state yet, so
+ // probes won't get called anyway.
+ // (2) There really isn't an event
+ // associated with this callback call,
+ // we just want to let the caller
+ // attach to the thread.
+ rc = cb_tgt->callback(tsk, 1, 0, cb_tgt);
if (rc != 0) {
_stp_error("attach callback for %d failed: %d",
(int)tsk->pid, rc);
diff --git a/tapsets.cxx b/tapsets.cxx
index 8203c568..c1bc88b0 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5487,7 +5487,7 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s)
// Output task finder callback routine that gets called for all
// utrace probe types.
- s.op->newline() << "static int _stp_utrace_probe_cb(struct task_struct *tsk, int register_p, struct stap_task_finder_target *tgt) {";
+ s.op->newline() << "static int _stp_utrace_probe_cb(struct task_struct *tsk, int register_p, unsigned long event_flag, struct stap_task_finder_target *tgt) {";
s.op->indent(1);
s.op->newline() << "int rc = 0;";
s.op->newline() << "struct stap_utrace_probe *p = container_of(tgt, struct stap_utrace_probe, tgt);";
@@ -5508,7 +5508,10 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s)
{
s.op->newline() << "case UTRACE_EVENT(EXEC):";
s.op->indent(1);
+ s.op->newline() << "if (event_flag == UTRACE_EVENT(EXEC)) {";
+ s.op->indent(1);
s.op->newline() << "stap_utrace_probe_handler(tsk, p);";
+ s.op->newline(-1) << "}";
s.op->newline() << "break;";
s.op->indent(-1);
}
@@ -5561,7 +5564,7 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s)
// For death probes, go ahead and call the probe directly.
if (flags_seen[UDPF_DEATH])
{
- s.op->newline() << "if (p->flags == UTRACE_EVENT(DEATH)) {";
+ s.op->newline() << "if (p->flags == UTRACE_EVENT(DEATH) && event_flag == UTRACE_EVENT(DEATH)) {";
s.op->indent(1);
s.op->newline() << "stap_utrace_probe_handler(tsk, p);";
s.op->newline(-1) << "}";