2 * Copyright (C) 2005-2008 Red Hat Inc.
3 * Copyright (C) 2005, 2006 Intel Corporation.
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
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>
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."
38 /* older kernels have no debugfs and older version of relayfs. */
39 #define STP_OLD_TRANSPORT
43 #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
46 static void _stp_dbug (const char *func
, int line
, const char *fmt
, ...);
47 void _stp_error (const char *fmt
, ...);
52 static atomic_t _stp_transport_failures
= ATOMIC_INIT (0);
56 atomic_t ____cacheline_aligned_in_smp seq
;
57 } _stp_seq
= { ATOMIC_INIT (0) };
59 #define _stp_seq_inc() (atomic_inc_return(&_stp_seq.seq))
61 /* TEST_MODE is always defined by systemtap */
65 #define MAXTRYLOCK 1000
66 #define TRYLOCKDELAY 100
70 #define MAXSTRINGLEN 128
84 /* Support functions for int64_t module parameters. */
85 int param_set_int64_t(const char *val
, struct kernel_param
*kp
)
93 /* simple_strtoll isn't exported... */
95 ll
= -simple_strtoull(val
+1, &endp
, 0);
97 ll
= simple_strtoull(val
, &endp
, 0);
99 if ((endp
== val
) || ((int64_t)ll
!= ll
))
102 *((int64_t *)kp
->arg
) = ll
;
106 int param_get_int64_t(char *buffer
, struct kernel_param
*kp
)
108 return sprintf(buffer
, "%lli", (long long)*((int64_t *)kp
->arg
));
111 #define param_check_int64_t(name, p) __param_check(name, p, int64_t)
114 /************* Module Stuff ********************/
116 int init_module (void)
118 return _stp_transport_init();
121 int probe_start(void);
123 void cleanup_module(void)
125 _stp_transport_close();
128 MODULE_LICENSE("GPL");
130 #endif /* _RUNTIME_H_ */