summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/ChangeLog5
-rw-r--r--runtime/sduprobes.c69
-rw-r--r--runtime/sduprobes.h56
3 files changed, 130 insertions, 0 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 3b935e3a..f940ad38 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-11 Stan Cox <scox@redhat.com>
+
+ * sduprobes.c: New file.
+ * sduprobes.h: New file.
+
2008-11-17 Wenji Huang <wenji.huang@oracle.com>
* runtime.h: Rename for_each_cpu to stp_for_each_cpu for 2.6.28.
diff --git a/runtime/sduprobes.c b/runtime/sduprobes.c
new file mode 100644
index 00000000..4bee3bd7
--- /dev/null
+++ b/runtime/sduprobes.c
@@ -0,0 +1,69 @@
+// Copyright (C) 2005-2008 Red Hat Inc.
+// Copyright (C) 2006 Intel Corporation.
+//
+// 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.
+
+#include <stddef.h>
+#define unused __attribute__ ((unused))
+
+int _stap_probe_sentinel = 0;
+
+void
+_stap_probe_start()
+{
+ _stap_probe_sentinel = 1;
+}
+
+int
+_stap_probe_0 (char* probe unused)
+{
+ return 1;
+}
+
+int
+_stap_probe_1 (char* probe unused,
+ size_t arg1 unused)
+{
+ return 1;
+}
+
+int
+_stap_probe_2 (char* probe unused ,
+ size_t arg1 unused,
+ size_t arg2 unused)
+{
+ return 1;
+}
+
+int
+_stap_probe_3 (char* probe unused,
+ size_t arg1 unused,
+ size_t arg2 unused,
+ size_t arg3 unused)
+{
+ return 1;
+}
+
+int
+_stap_probe_4 (char* probe unused,
+ size_t arg1 unused,
+ size_t arg2 unused,
+ size_t arg3 unused,
+ size_t arg4 unused)
+{
+ return 1;
+}
+
+int
+_stap_probe_5 (char* probe unused,
+ size_t arg1 unused,
+ size_t arg2 unused,
+ size_t arg3 unused,
+ size_t arg4 unused,
+ size_t arg5 unused)
+{
+ return 1;
+}
diff --git a/runtime/sduprobes.h b/runtime/sduprobes.h
new file mode 100644
index 00000000..b2c32e43
--- /dev/null
+++ b/runtime/sduprobes.h
@@ -0,0 +1,56 @@
+// Copyright (C) 2005-2008 Red Hat Inc.
+// Copyright (C) 2006 Intel Corporation.
+//
+// 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.
+
+#include <stdlib.h>
+#include <string.h>
+extern int _stap_probe_sentinel;
+
+#define STAP_PROBE_START() \
+ char *stap_sdt = getenv("SYSTEMTAP_SDT"); \
+ if (stap_sdt != NULL) \
+ _stap_probe_start ()
+
+#define STAP_PROBE_STRUCT(probe,argc) \
+struct _probe_ ## probe \
+{ \
+ char probe_name [strlen(#probe)+1]; \
+ int arg_count; \
+}; \
+static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {#probe,argc};
+
+#define STAP_PROBE(provider,probe) \
+STAP_PROBE_STRUCT(probe,0) \
+ if (__builtin_expect(_stap_probe_sentinel, 0)) \
+ _stap_probe_0 (_probe_ ## probe.probe_name);
+
+
+#define STAP_PROBE1(provider,probe,arg1) \
+STAP_PROBE_STRUCT(probe,1) \
+ if (__builtin_expect(_stap_probe_sentinel, 0)) \
+ _stap_probe_1 (_probe_ ## probe.probe_name,(size_t)arg1);
+
+
+#define STAP_PROBE2(provider,probe,arg1,arg2) \
+STAP_PROBE_STRUCT(probe,2) \
+ if (__builtin_expect(_stap_probe_sentinel, 0)) \
+ _stap_probe_2 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2);
+
+#define STAP_PROBE3(provider,probe,arg1,arg2,arg3) \
+STAP_PROBE_STRUCT(probe,3) \
+ if (__builtin_expect(_stap_probe_sentinel, 0)) \
+ _stap_probe_3 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3);
+
+#define STAP_PROBE4(provider,probe,arg1,arg2,arg3,arg4) \
+STAP_PROBE_STRUCT(probe,4) \
+ if (__builtin_expect(_stap_probe_sentinel, 0)) \
+ _stap_probe_4 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4);
+
+#define STAP_PROBE5(provider,probe,arg1,arg2,arg3,arg4,arg5) \
+STAP_PROBE_STRUCT(probe,5) \
+ if (__builtin_expect(_stap_probe_sentinel, 0)) \
+ _stap_probe_5 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4,(size_t)arg5);