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 /runtime/utrace_compatibility.h | |
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 'runtime/utrace_compatibility.h')
-rw-r--r-- | runtime/utrace_compatibility.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/runtime/utrace_compatibility.h b/runtime/utrace_compatibility.h new file mode 100644 index 00000000..80037015 --- /dev/null +++ b/runtime/utrace_compatibility.h @@ -0,0 +1,57 @@ +/* + * utrace compatibility defines and inlines + * Copyright (C) 2008 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + +#ifndef _UTRACE_COMPATIBILITY_H_ +#define _UTRACE_COMPATIBILITY_H_ + +#include <linux/utrace.h> + +#ifdef UTRACE_ACTION_RESUME + +/* + * If UTRACE_ACTION_RESUME is defined after including utrace.h, we've + * got the original version of utrace. So that utrace clients can be + * written using the new interface (mostly), provide a (very thin) + * compatibility layer that hides the differences. + */ + +#define UTRACE_ORIG_VERSION + +#define UTRACE_RESUME UTRACE_ACTION_RESUME +#define UTRACE_DETACH UTRACE_ACTION_DETACH +#define UTRACE_STOP UTRACE_ACTION_QUIESCE + +static inline struct utrace_attached_engine * +utrace_attach_task(struct task_struct *target, int flags, + const struct utrace_engine_ops *ops, void *data) +{ + return utrace_attach(target, flags, ops, data); +} + +static inline int __must_check +utrace_control(struct task_struct *target, + struct utrace_attached_engine *engine, + unsigned long action) +{ + if (action == UTRACE_DETACH) + return utrace_detach(target, engine); + return -EINVAL; +} + +static inline int __must_check +utrace_set_events(struct task_struct *target, + struct utrace_attached_engine *engine, + unsigned long eventmask) +{ + return utrace_set_flags(target, engine, eventmask); +} +#endif + +#endif /* _UTRACE_COMPATIBILITY_H_ */ |