From cfac4b1fc487712e0ce5b11630b74bdaea5f8966 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 21 May 2008 12:59:56 -0500 Subject: Minor improvement to multi-threaded support. 2008-05-21 David Smith * 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-21 David Smith * 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. --- tapsets.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') 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) << "}"; -- cgit