diff options
author | David Smith <dsmith@redhat.com> | 2008-08-20 15:05:57 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2008-08-20 15:07:30 -0500 |
commit | 4550733ebf24fb067f9a2350e0ab86d44fea932e (patch) | |
tree | e30259e4d9620eb6fc277629959e39b675366214 /tapsets.cxx | |
parent | 2ae0d25c4181d2d7e89690013f935ad27e071457 (diff) | |
download | systemtap-steved-4550733ebf24fb067f9a2350e0ab86d44fea932e.tar.gz systemtap-steved-4550733ebf24fb067f9a2350e0ab86d44fea932e.tar.xz systemtap-steved-4550733ebf24fb067f9a2350e0ab86d44fea932e.zip |
Supports original and new utrace interfaces.
2008-08-20 David Smith <dsmith@redhat.com>
* tapsets.cxx (utrace_derived_probe_group::emit_probe_decl):
Supports original and new utrace interfaces.
(utrace_derived_probe_group::emit_module_decls): Ditto.
2008-08-20 David Smith <dsmith@redhat.com>
* task_finder.c: Supports original and new utrace interfaces.
* utrace_compatibility.h (utrace_attach_task): Compatibility layer
for original utrace interface.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index 36601b01..d2e5bdba 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -6076,12 +6076,12 @@ utrace_derived_probe_group::emit_probe_decl (systemtap_session& s, case UDPF_BEGIN: // process begin s.op->line() << " .flags=(UDPF_BEGIN),"; s.op->line() << " .ops={ .report_quiesce=stap_utrace_probe_quiesce },"; - s.op->line() << " .events=(UTRACE_ACTION_QUIESCE|UTRACE_EVENT(QUIESCE)),"; + s.op->line() << " .events=(UTRACE_STOP|UTRACE_EVENT(QUIESCE)),"; break; case UDPF_THREAD_BEGIN: // thread begin s.op->line() << " .flags=(UDPF_THREAD_BEGIN),"; s.op->line() << " .ops={ .report_quiesce=stap_utrace_probe_quiesce },"; - s.op->line() << " .events=(UTRACE_ACTION_QUIESCE|UTRACE_EVENT(QUIESCE)),"; + s.op->line() << " .events=(UTRACE_STOP|UTRACE_EVENT(QUIESCE)),"; break; // Notice we're not setting up a .ops/.report_death handler for @@ -6101,12 +6101,12 @@ utrace_derived_probe_group::emit_probe_decl (systemtap_session& s, case UDPF_SYSCALL: s.op->line() << " .flags=(UDPF_SYSCALL),"; s.op->line() << " .ops={ .report_syscall_entry=stap_utrace_probe_syscall, .report_death=stap_utrace_task_finder_report_death, .report_quiesce=stap_utrace_probe_syscall_quiesce },"; - s.op->line() << " .events=(UTRACE_ACTION_QUIESCE|UTRACE_EVENT(QUIESCE)|UTRACE_EVENT(DEATH)),"; + s.op->line() << " .events=(UTRACE_STOP|UTRACE_EVENT(QUIESCE)|UTRACE_EVENT(DEATH)),"; break; case UDPF_SYSCALL_RETURN: s.op->line() << " .flags=(UDPF_SYSCALL_RETURN),"; s.op->line() << " .ops={ .report_syscall_exit=stap_utrace_probe_syscall, .report_death=stap_utrace_task_finder_report_death, .report_quiesce=stap_utrace_probe_syscall_quiesce },"; - s.op->line() << " .events=(UTRACE_ACTION_QUIESCE|UTRACE_EVENT(QUIESCE)|UTRACE_EVENT(DEATH)),"; + s.op->line() << " .events=(UTRACE_STOP|UTRACE_EVENT(QUIESCE)|UTRACE_EVENT(DEATH)),"; break; case UDPF_NONE: @@ -6192,7 +6192,11 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) // Output handler function for UDPF_BEGIN and UDPF_THREAD_BEGIN if (flags_seen[UDPF_BEGIN] || flags_seen[UDPF_THREAD_BEGIN]) { + s.op->newline() << "#ifdef UTRACE_ORIG_VERSION"; s.op->newline() << "static u32 stap_utrace_probe_quiesce(struct utrace_attached_engine *engine, struct task_struct *tsk) {"; + s.op->newline() << "#else"; + s.op->newline() << "static u32 stap_utrace_probe_quiesce(enum utrace_resume_action action, struct utrace_attached_engine *engine, struct task_struct *tsk, unsigned long event) {"; + s.op->newline() << "#endif"; s.op->indent(1); s.op->newline() << "struct stap_utrace_probe *p = (struct stap_utrace_probe *)engine->data;"; @@ -6203,10 +6207,9 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*p->ph) (c);"; common_probe_entryfn_epilogue (s.op); - // UTRACE_ACTION_NEWSTATE not needed here to clear quiesce since - // we're detaching - utrace automatically restarts the thread. + // we're detaching, so utrace automatically restarts the thread. s.op->newline() << "debug_task_finder_detach();"; - s.op->newline() << "return UTRACE_ACTION_DETACH;"; + s.op->newline() << "return UTRACE_DETACH;"; s.op->newline(-1) << "}"; } @@ -6230,25 +6233,39 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) // Output handler function for SYSCALL_ENTRY and SYSCALL_EXIT events if (flags_seen[UDPF_SYSCALL] || flags_seen[UDPF_SYSCALL_RETURN]) { + s.op->newline() << "#ifdef UTRACE_ORIG_VERSION"; s.op->newline() << "static u32 stap_utrace_probe_syscall_quiesce(struct utrace_attached_engine *engine, struct task_struct *tsk) {"; + s.op->newline() << "#else"; + s.op->newline() << "static u32 stap_utrace_probe_syscall_quiesce(enum utrace_resume_action action, struct utrace_attached_engine *engine, struct task_struct *tsk, unsigned long event) {"; + s.op->newline() << "#endif"; s.op->indent(1); s.op->newline() << "struct stap_utrace_probe *p = (struct stap_utrace_probe *)engine->data;"; + s.op->newline() << "int rc = 0;"; // Turn off quiesce handling and turn on either syscall entry // or exit events. s.op->newline() << "if (p->flags == UDPF_SYSCALL)"; s.op->indent(1); - s.op->newline() << "utrace_set_flags(tsk, engine, UTRACE_EVENT(SYSCALL_ENTRY)|UTRACE_EVENT(DEATH));"; + s.op->newline() << "rc = utrace_set_events(tsk, engine, UTRACE_EVENT(SYSCALL_ENTRY)|UTRACE_EVENT(DEATH));"; s.op->indent(-1); s.op->newline() << "else if (p->flags == UDPF_SYSCALL_RETURN)"; s.op->indent(1); - s.op->newline() << "utrace_set_flags(tsk, engine, UTRACE_EVENT(SYSCALL_EXIT)|UTRACE_EVENT(DEATH));"; + s.op->newline() << "rc = utrace_set_events(tsk, engine, UTRACE_EVENT(SYSCALL_EXIT)|UTRACE_EVENT(DEATH));"; + s.op->indent(-1); + s.op->newline() << "if (rc != 0)"; + s.op->indent(1); + s.op->newline() << "_stp_error(\"utrace_set_events returned error %d on pid %d\", rc, (int)tsk->pid);"; s.op->indent(-1); - s.op->newline() << "return (UTRACE_ACTION_NEWSTATE | UTRACE_ACTION_RESUME);"; + s.op->newline() << "return UTRACE_RESUME;"; s.op->newline(-1) << "}"; + s.op->newline() << "#ifdef UTRACE_ORIG_VERSION"; s.op->newline() << "static u32 stap_utrace_probe_syscall(struct utrace_attached_engine *engine, struct task_struct *tsk, struct pt_regs *regs) {"; + s.op->newline() << "#else"; + s.op->newline() << "static u32 stap_utrace_probe_syscall(enum utrace_resume_action action, struct utrace_attached_engine *engine, struct task_struct *tsk, struct pt_regs *regs) {"; + s.op->newline() << "#endif"; + s.op->indent(1); s.op->newline() << "struct stap_utrace_probe *p = (struct stap_utrace_probe *)engine->data;"; @@ -6260,7 +6277,7 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "(*p->ph) (c);"; common_probe_entryfn_epilogue (s.op); - s.op->newline() << "return UTRACE_ACTION_RESUME;"; + s.op->newline() << "return UTRACE_RESUME;"; s.op->newline(-1) << "}"; } |