]> sourceware.org Git - systemtap.git/blob - runtime/runtime.h
rebased unwind_branch on top of current master
[systemtap.git] / runtime / runtime.h
1 /* main header file
2 * Copyright (C) 2005-2008 Red Hat Inc.
3 * Copyright (C) 2005, 2006 Intel Corporation.
4 *
5 * This file is part of systemtap, and is free software. You can
6 * redistribute it and/or modify it under the terms of the GNU General
7 * Public License (GPL); either version 2, or (at your option) any
8 * later version.
9 */
10
11 #ifndef _RUNTIME_H_
12 #define _RUNTIME_H_
13
14 #include <linux/module.h>
15 #include <linux/ctype.h>
16 #include <linux/kernel.h>
17 #include <linux/miscdevice.h>
18 #include <linux/init.h>
19 #include <linux/hash.h>
20 #include <linux/string.h>
21 #include <linux/kprobes.h>
22 #include <linux/proc_fs.h>
23 #include <linux/vmalloc.h>
24 #include <linux/time.h>
25 #include <linux/spinlock.h>
26 #include <linux/hardirq.h>
27 #include <asm/uaccess.h>
28 #include <linux/kallsyms.h>
29 #include <linux/version.h>
30 #include <linux/compat.h>
31 #include <linux/mm.h>
32
33 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
34 #if !defined (CONFIG_DEBUG_FS) && !defined (CONFIG_DEBUG_FS_MODULE)
35 #error "DebugFS is required and was not found in the kernel."
36 #endif
37 #else
38 /* older kernels have no debugfs and older version of relayfs. */
39 #define STP_OLD_TRANSPORT
40 #endif
41
42 #ifndef for_each_cpu
43 #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
44 #endif
45
46 static void _stp_dbug (const char *func, int line, const char *fmt, ...);
47 void _stp_error (const char *fmt, ...);
48
49 #include "debug.h"
50
51 /* atomic globals */
52 static atomic_t _stp_transport_failures = ATOMIC_INIT (0);
53
54 static struct
55 {
56 atomic_t ____cacheline_aligned_in_smp seq;
57 } _stp_seq = { ATOMIC_INIT (0) };
58
59 #define _stp_seq_inc() (atomic_inc_return(&_stp_seq.seq))
60
61 /* TEST_MODE is always defined by systemtap */
62 #ifdef TEST_MODE
63 #define SYSTEMTAP 1
64 #else
65 #define MAXTRYLOCK 1000
66 #define TRYLOCKDELAY 100
67 #endif
68
69 #ifndef MAXSTRINGLEN
70 #define MAXSTRINGLEN 128
71 #endif
72
73 #include "alloc.c"
74 #include "print.c"
75 #include "string.c"
76 #include "io.c"
77 #include "arith.c"
78 #include "copy.c"
79 #include "sym.c"
80 #ifdef STP_PERFMON
81 #include "perf.c"
82 #endif
83
84 /* Support functions for int64_t module parameters. */
85 int param_set_int64_t(const char *val, struct kernel_param *kp)
86 {
87 char *endp;
88 long long ll;
89
90 if (!val)
91 return -EINVAL;
92
93 /* simple_strtoll isn't exported... */
94 if (*val == '-')
95 ll = -simple_strtoull(val+1, &endp, 0);
96 else
97 ll = simple_strtoull(val, &endp, 0);
98
99 if ((endp == val) || ((int64_t)ll != ll))
100 return -EINVAL;
101
102 *((int64_t *)kp->arg) = ll;
103 return 0;
104 }
105
106 int param_get_int64_t(char *buffer, struct kernel_param *kp)
107 {
108 return sprintf(buffer, "%lli", (long long)*((int64_t *)kp->arg));
109 }
110
111 #define param_check_int64_t(name, p) __param_check(name, p, int64_t)
112
113
114 /************* Module Stuff ********************/
115
116 int init_module (void)
117 {
118 return _stp_transport_init();
119 }
120
121 int probe_start(void);
122
123 void cleanup_module(void)
124 {
125 _stp_transport_close();
126 }
127
128 MODULE_LICENSE("GPL");
129
130 #endif /* _RUNTIME_H_ */
This page took 0.041345 seconds and 5 git commands to generate.