From 4550733ebf24fb067f9a2350e0ab86d44fea932e Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 20 Aug 2008 15:05:57 -0500 Subject: Supports original and new utrace interfaces. 2008-08-20 David Smith * 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 * task_finder.c: Supports original and new utrace interfaces. * utrace_compatibility.h (utrace_attach_task): Compatibility layer for original utrace interface. --- runtime/utrace_compatibility.h | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 runtime/utrace_compatibility.h (limited to 'runtime/utrace_compatibility.h') 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 + +#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_ */ -- cgit