summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-01-28 14:36:08 -0800
committerJosh Stone <jistone@redhat.com>2009-01-28 17:16:50 -0800
commit4c2732a1dad1de295c9219ee3afac007b2d7ba05 (patch)
treefb84977ad73f62ce57a147e9c3d6bf869376737c /runtime
parent83e08fc5458e8196d5f0ed5790f9f7de77a80bb6 (diff)
downloadsystemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.tar.gz
systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.tar.xz
systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.zip
Use 'static' as much as possible
This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/addr-map.c8
-rw-r--r--runtime/alloc.c16
-rw-r--r--runtime/arith.c22
-rw-r--r--runtime/copy.c7
-rw-r--r--runtime/counter.c10
-rw-r--r--runtime/debug.h2
-rw-r--r--runtime/io.c10
-rw-r--r--runtime/itrace.c2
-rw-r--r--runtime/map-gen.c16
-rw-r--r--runtime/map.c42
-rw-r--r--runtime/map.h30
-rw-r--r--runtime/perf.c6
-rw-r--r--runtime/perf.h6
-rw-r--r--runtime/pmap-gen.c18
-rw-r--r--runtime/print.c16
-rw-r--r--runtime/print_new.c2
-rw-r--r--runtime/procfs.c10
-rw-r--r--runtime/regs.c18
-rw-r--r--runtime/runtime.h8
-rw-r--r--runtime/stack.c6
-rw-r--r--runtime/stat.c12
-rw-r--r--runtime/string.c6
-rw-r--r--runtime/string.h4
-rw-r--r--runtime/sym.c8
-rw-r--r--runtime/sym.h6
-rw-r--r--runtime/task_finder.c12
-rw-r--r--runtime/time.c12
-rw-r--r--runtime/transport/control.c2
-rw-r--r--runtime/transport/relayfs.c8
-rw-r--r--runtime/transport/relayfs.h4
-rw-r--r--runtime/transport/symbols.c2
-rw-r--r--runtime/transport/transport.c16
-rw-r--r--runtime/transport/transport.h20
-rw-r--r--runtime/transport/utt.c12
-rw-r--r--runtime/transport/utt.h10
-rw-r--r--runtime/unwind.c4
-rw-r--r--runtime/vsprintf.c2
37 files changed, 197 insertions, 198 deletions
diff --git a/runtime/addr-map.c b/runtime/addr-map.c
index 706da454..e898044f 100644
--- a/runtime/addr-map.c
+++ b/runtime/addr-map.c
@@ -30,7 +30,7 @@ struct addr_map
static DEFINE_SPINLOCK(addr_map_lock);
-struct addr_map* blackmap;
+static struct addr_map* blackmap;
/* Find address of entry where we can insert a new one. */
static size_t
@@ -88,7 +88,7 @@ lookup_addr_aux(unsigned long addr, struct addr_map* map)
return 0;
}
-int
+static int
lookup_bad_addr(unsigned long addr)
{
struct addr_map_entry* result = 0;
@@ -102,7 +102,7 @@ lookup_bad_addr(unsigned long addr)
}
-int
+static int
add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr,
struct addr_map_entry** existing_min,
struct addr_map_entry** existing_max)
@@ -181,7 +181,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr,
return 0;
}
-void
+static void
delete_bad_addr_entry(struct addr_map_entry* entry)
{
}
diff --git a/runtime/alloc.c b/runtime/alloc.c
index cfdb97bd..89d16612 100644
--- a/runtime/alloc.c
+++ b/runtime/alloc.c
@@ -63,7 +63,7 @@ struct _stp_mem_entry {
static LIST_HEAD(_stp_mem_list);
-void _stp_check_mem_fence (char *addr, int size)
+static void _stp_check_mem_fence (char *addr, int size)
{
char *ptr;
int i;
@@ -88,7 +88,7 @@ void _stp_check_mem_fence (char *addr, int size)
}
}
-void *_stp_mem_debug_setup(void *addr, size_t size, enum _stp_memtype type)
+static void *_stp_mem_debug_setup(void *addr, size_t size, enum _stp_memtype type)
{
struct list_head *p;
struct _stp_mem_entry *m;
@@ -108,7 +108,7 @@ void *_stp_mem_debug_setup(void *addr, size_t size, enum _stp_memtype type)
}
/* Percpu allocations don't have the fence. Implementing it is problematic. */
-void _stp_mem_debug_percpu(struct _stp_mem_entry *m, void *addr, size_t size)
+static void _stp_mem_debug_percpu(struct _stp_mem_entry *m, void *addr, size_t size)
{
struct list_head *p = (struct list_head *)m;
m->magic = MEM_MAGIC;
@@ -120,7 +120,7 @@ void _stp_mem_debug_percpu(struct _stp_mem_entry *m, void *addr, size_t size)
spin_unlock(&_stp_mem_lock);
}
-void _stp_mem_debug_free(void *addr, enum _stp_memtype type)
+static void _stp_mem_debug_free(void *addr, enum _stp_memtype type)
{
int found = 0;
struct list_head *p, *tmp;
@@ -291,7 +291,7 @@ static void *_stp_kmalloc_node(size_t size, int node)
}
#endif /* LINUX_VERSION_CODE */
-void _stp_kfree(void *addr)
+static void _stp_kfree(void *addr)
{
#ifdef DEBUG_MEM
_stp_mem_debug_free(addr, MEM_KMALLOC);
@@ -300,7 +300,7 @@ void _stp_kfree(void *addr)
#endif
}
-void _stp_vfree(void *addr)
+static void _stp_vfree(void *addr)
{
#ifdef DEBUG_MEM
_stp_mem_debug_free(addr, MEM_VMALLOC);
@@ -309,7 +309,7 @@ void _stp_vfree(void *addr)
#endif
}
-void _stp_free_percpu(void *addr)
+static void _stp_free_percpu(void *addr)
{
#ifdef DEBUG_MEM
_stp_mem_debug_free(addr, MEM_PERCPU);
@@ -318,7 +318,7 @@ void _stp_free_percpu(void *addr)
#endif
}
-void _stp_mem_debug_done(void)
+static void _stp_mem_debug_done(void)
{
#ifdef DEBUG_MEM
struct list_head *p, *tmp;
diff --git a/runtime/arith.c b/runtime/arith.c
index 60576090..d1d0da29 100644
--- a/runtime/arith.c
+++ b/runtime/arith.c
@@ -21,21 +21,21 @@
/* Other 32-bit cpus will need to modify this file. */
#if defined (__i386__) || defined(__arm__)
-long long _div64 (long long u, long long v);
-long long _mod64 (long long u, long long v);
+static long long _div64 (long long u, long long v);
+static long long _mod64 (long long u, long long v);
#endif
/* 31 bit s390 suupport is not yet included, it may never be.
#ifdef __s390__
-long long _div64 (long long u, long long v);
-long long _mod64 (long long u, long long v);
+static long long _div64 (long long u, long long v);
+static long long _mod64 (long long u, long long v);
#endif
*/
/** Divide x by y. In case of division-by-zero,
* set context error string, and return 0
*/
-int64_t _stp_div64 (const char **error, int64_t x, int64_t y)
+static int64_t _stp_div64 (const char **error, int64_t x, int64_t y)
{
// check for division-by-zero
if (unlikely (y == 0)) {
@@ -61,7 +61,7 @@ int64_t _stp_div64 (const char **error, int64_t x, int64_t y)
/** Modulo x by y. In case of division-by-zero,
* set context error string, and return any 0
*/
-int64_t _stp_mod64 (const char **error, int64_t x, int64_t y)
+static int64_t _stp_mod64 (const char **error, int64_t x, int64_t y)
{
// check for division-by-zero
if (unlikely (y == 0)) {
@@ -88,7 +88,7 @@ int64_t _stp_mod64 (const char **error, int64_t x, int64_t y)
/** Return a random integer between -n and n.
* @param n how far from zero to go. Make it positive but less than a million or so.
*/
-int _stp_random_pm (int n)
+static int _stp_random_pm (int n)
{
static unsigned long seed;
static int initialized_p = 0;
@@ -251,7 +251,7 @@ typedef union
#endif
#if !defined (count_leading_zeros)
-const UQItype _stp_clz_tab[256] =
+static const UQItype _stp_clz_tab[256] =
{
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
@@ -286,7 +286,7 @@ const UQItype _stp_clz_tab[256] =
#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE
#endif
-UDWtype
+static UDWtype
_stp_udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
{
const DWunion nn = {.ll = n};
@@ -499,7 +499,7 @@ _stp_udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
return ww.ll;
}
-long long _div64 (long long u, long long v)
+static long long _div64 (long long u, long long v)
{
long c = 0;
DWunion uu = {.ll = u};
@@ -520,7 +520,7 @@ long long _div64 (long long u, long long v)
return w;
}
-long long _mod64 (long long u, long long v)
+static long long _mod64 (long long u, long long v)
{
long c = 0;
DWunion uu = {.ll = u};
diff --git a/runtime/copy.c b/runtime/copy.c
index 6bb22762..4fb87253 100644
--- a/runtime/copy.c
+++ b/runtime/copy.c
@@ -47,8 +47,7 @@
})
-long _stp_strncpy_from_user(char *dst, const char __user *src, long count);
-//static long __stp_strncpy_from_user(char *dst, const char __user *src, long count);
+static long __stp_strncpy_from_user(char *dst, const char __user *src, long count);
#if defined (__i386__)
#define __stp_strncpy_from_user(dst,src,count,res) \
@@ -131,7 +130,7 @@ do { \
* <i>count</i> bytes and returns <i>count</i>.
*/
-long _stp_strncpy_from_user(char *dst, const char __user *src, long count)
+static long _stp_strncpy_from_user(char *dst, const char __user *src, long count)
{
long res = -EFAULT;
if (access_ok(VERIFY_READ, src, count))
@@ -152,7 +151,7 @@ long _stp_strncpy_from_user(char *dst, const char __user *src, long count)
*
*/
-unsigned long _stp_copy_from_user(char *dst, const char __user *src, unsigned long count)
+static unsigned long _stp_copy_from_user(char *dst, const char __user *src, unsigned long count)
{
if (count) {
if (access_ok(VERIFY_READ, src, count))
diff --git a/runtime/counter.c b/runtime/counter.c
index a3c3669b..40ea66a0 100644
--- a/runtime/counter.c
+++ b/runtime/counter.c
@@ -52,7 +52,7 @@ typedef struct _counter *Counter;
*
* @return a Counter. Will be NULL on error.
*/
-Counter _stp_counter_init (void)
+static Counter _stp_counter_init (void)
{
Counter cnt = _stp_alloc_percpu (struct _counter);
#if NEED_COUNTER_LOCKS == 1
@@ -73,7 +73,7 @@ Counter _stp_counter_init (void)
* @param cnt Counter
* @param val int64 value
*/
-void _stp_counter_add (Counter cnt, int64_t val)
+static void _stp_counter_add (Counter cnt, int64_t val)
{
Counter c = per_cpu_ptr (cnt, get_cpu());
COUNTER_LOCK(c);
@@ -90,7 +90,7 @@ void _stp_counter_add (Counter cnt, int64_t val)
* @param clear Set this to have the value cleared after reading.
* @return An int64 value.
*/
-int64_t _stp_counter_get_cpu (Counter cnt, int cpu, int clear)
+static int64_t _stp_counter_get_cpu (Counter cnt, int cpu, int clear)
{
int64_t val;
Counter c = per_cpu_ptr (cnt, cpu);
@@ -114,7 +114,7 @@ int64_t _stp_counter_get_cpu (Counter cnt, int cpu, int clear)
* @param clear Set this to have the value cleared after reading.
* @return An int64 value.
*/
-int64_t _stp_counter_get (Counter cnt, int clear)
+static int64_t _stp_counter_get (Counter cnt, int clear)
{
int i;
int64_t sum = 0;
@@ -133,7 +133,7 @@ int64_t _stp_counter_get (Counter cnt, int clear)
/** Free a Counter.
* @param cnt Counter
*/
-void _stp_counter_free (Counter cnt)
+static void _stp_counter_free (Counter cnt)
{
_stp_free_percpu (cnt);
}
diff --git a/runtime/debug.h b/runtime/debug.h
index 9b2fe5c5..e8b2e701 100644
--- a/runtime/debug.h
+++ b/runtime/debug.h
@@ -14,7 +14,7 @@
* _dbug() writes to systemtap stderr.
* errk() writes to the system log.
*/
-int _stp_transport_state = 0;
+static int _stp_transport_state = 0;
#define _dbug(args...) _stp_dbug(__FUNCTION__, __LINE__, args)
diff --git a/runtime/io.c b/runtime/io.c
index c49d86e6..c7223fb0 100644
--- a/runtime/io.c
+++ b/runtime/io.c
@@ -66,7 +66,7 @@ static void _stp_vlog (enum code type, const char *func, int line, const char *f
* @param fmt A variable number of args.
* @todo Evaluate if this function is necessary.
*/
-void _stp_log (const char *fmt, ...)
+static void _stp_log (const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -81,7 +81,7 @@ void _stp_log (const char *fmt, ...)
* is added.
* @param fmt A variable number of args.
*/
-void _stp_warn (const char *fmt, ...)
+static void _stp_warn (const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -97,7 +97,7 @@ void _stp_warn (const char *fmt, ...)
* call. You should probably call return immediately after
* calling _stp_exit().
*/
-void _stp_exit (void)
+static void _stp_exit (void)
{
_stp_exit_flag = 1;
}
@@ -112,7 +112,7 @@ void _stp_exit (void)
* @param fmt A variable number of args.
* @sa _stp_exit().
*/
-void _stp_error (const char *fmt, ...)
+static void _stp_error (const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -131,7 +131,7 @@ void _stp_error (const char *fmt, ...)
* @param fmt A variable number of args.
* @sa _stp_error
*/
-void _stp_softerror (const char *fmt, ...)
+static void _stp_softerror (const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
diff --git a/runtime/itrace.c b/runtime/itrace.c
index 3ee48265..df18a400 100644
--- a/runtime/itrace.c
+++ b/runtime/itrace.c
@@ -187,7 +187,7 @@ done:
}
-int usr_itrace_init(int single_step, pid_t tid, struct stap_itrace_probe *p)
+static int usr_itrace_init(int single_step, pid_t tid, struct stap_itrace_probe *p)
{
struct itrace_info *ui;
struct task_struct *tsk;
diff --git a/runtime/map-gen.c b/runtime/map-gen.c
index ce6e8742..c4bdf2c7 100644
--- a/runtime/map-gen.c
+++ b/runtime/map-gen.c
@@ -336,7 +336,7 @@ static unsigned int KEYSYM(hash) (ALLKEYSD(key))
#if VALUE_TYPE == INT64 || VALUE_TYPE == STRING
-MAP KEYSYM(_stp_map_new) (unsigned max_entries)
+static MAP KEYSYM(_stp_map_new) (unsigned max_entries)
{
MAP m = _stp_map_new (max_entries, VALUE_TYPE, sizeof(struct KEYSYM(map_node)), 0);
if (m)
@@ -347,7 +347,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries)
/* _stp_map_new_key1_key2...val (num, HIST_LINEAR, start, end, interval) */
/* _stp_map_new_key1_key2...val (num, HIST_LOG) */
-MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...)
+static MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...)
{
int start=0, stop=0, interval=0;
MAP m;
@@ -384,7 +384,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...)
}
#endif /* VALUE_TYPE */
-int KEYSYM(__stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add)
+static int KEYSYM(__stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add)
{
unsigned int hv;
struct hlist_head *head;
@@ -427,18 +427,18 @@ int KEYSYM(__stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add)
return MAP_SET_VAL(map,(struct map_node *)n, val, 0);
}
-int KEYSYM(_stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val)
+static int KEYSYM(_stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val)
{
return KEYSYM(__stp_map_set) (map, ALLKEYS(key), val, 0);
}
-int KEYSYM(_stp_map_add) (MAP map, ALLKEYSD(key), VSTYPE val)
+static int KEYSYM(_stp_map_add) (MAP map, ALLKEYSD(key), VSTYPE val)
{
return KEYSYM(__stp_map_set) (map, ALLKEYS(key), val, 1);
}
-VALTYPE KEYSYM(_stp_map_get) (MAP map, ALLKEYSD(key))
+static VALTYPE KEYSYM(_stp_map_get) (MAP map, ALLKEYSD(key))
{
unsigned int hv;
struct hlist_head *head;
@@ -474,7 +474,7 @@ VALTYPE KEYSYM(_stp_map_get) (MAP map, ALLKEYSD(key))
return NULLRET;
}
-int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key))
+static int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key))
{
unsigned int hv;
struct hlist_head *head;
@@ -511,7 +511,7 @@ int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key))
return 0;
}
-int KEYSYM(_stp_map_exists) (MAP map, ALLKEYSD(key))
+static int KEYSYM(_stp_map_exists) (MAP map, ALLKEYSD(key))
{
unsigned int hv;
struct hlist_head *head;
diff --git a/runtime/map.c b/runtime/map.c
index 5108e596..56f67dfb 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -26,17 +26,17 @@ static int map_sizes[] = {
0
};
-unsigned int int64_hash (const int64_t v)
+static unsigned int int64_hash (const int64_t v)
{
return (unsigned int)hash_long ((unsigned long)v, HASH_TABLE_BITS);
}
-int int64_eq_p (int64_t key1, int64_t key2)
+static int int64_eq_p (int64_t key1, int64_t key2)
{
return key1 == key2;
}
-void str_copy(char *dest, char *src)
+static void str_copy(char *dest, char *src)
{
int len = 0;
if (src) {
@@ -48,7 +48,7 @@ void str_copy(char *dest, char *src)
dest[len] = 0;
}
-void str_add(void *dest, char *val)
+static void str_add(void *dest, char *val)
{
char *dst = (char *)dest;
int len = strlen(val);
@@ -61,12 +61,12 @@ void str_add(void *dest, char *val)
dst[len + len1] = 0;
}
-int str_eq_p (char *key1, char *key2)
+static int str_eq_p (char *key1, char *key2)
{
return strncmp(key1, key2, MAP_STRING_LENGTH - 1) == 0;
}
-unsigned int str_hash(const char *key1)
+static unsigned int str_hash(const char *key1)
{
int hash = 0, count = 0;
char *v1 = (char *)key1;
@@ -88,7 +88,7 @@ unsigned int str_hash(const char *key1)
* @param m pointer to the map_node.
* @returns an int64 value.
*/
-int64_t _stp_get_int64(struct map_node *m)
+static int64_t _stp_get_int64(struct map_node *m)
{
if (!m || m->map->type != INT64)
return 0;
@@ -102,7 +102,7 @@ int64_t _stp_get_int64(struct map_node *m)
* @param m pointer to the map_node.
* @returns a pointer to a string.
*/
-char *_stp_get_str(struct map_node *m)
+static char *_stp_get_str(struct map_node *m)
{
if (!m || m->map->type != STRING)
return "bad type";
@@ -116,7 +116,7 @@ char *_stp_get_str(struct map_node *m)
* @param m pointer to the map_node.
* @returns A pointer to the stats.
*/
-stat *_stp_get_stat(struct map_node *m)
+static stat *_stp_get_stat(struct map_node *m)
{
if (!m || m->map->type != STAT)
return 0;
@@ -130,7 +130,7 @@ stat *_stp_get_stat(struct map_node *m)
* @returns an int64
* @sa key1int(), key2int()
*/
-int64_t _stp_key_get_int64 (struct map_node *mn, int n)
+static int64_t _stp_key_get_int64 (struct map_node *mn, int n)
{
int type;
int64_t res = 0;
@@ -150,7 +150,7 @@ int64_t _stp_key_get_int64 (struct map_node *mn, int n)
* @returns a pointer to a string
* @sa key1str(), key2str()
*/
-char *_stp_key_get_str (struct map_node *mn, int n)
+static char *_stp_key_get_str (struct map_node *mn, int n)
{
int type;
char *str = "";
@@ -290,7 +290,7 @@ err:
* @sa foreach
*/
-struct map_node *_stp_map_start(MAP map)
+static struct map_node *_stp_map_start(MAP map)
{
if (map == NULL)
return NULL;
@@ -313,7 +313,7 @@ struct map_node *_stp_map_start(MAP map)
* @sa foreach
*/
-struct map_node *_stp_map_iter(MAP map, struct map_node *m)
+static struct map_node *_stp_map_iter(MAP map, struct map_node *m)
{
if (map == NULL)
return NULL;
@@ -328,7 +328,7 @@ struct map_node *_stp_map_iter(MAP map, struct map_node *m)
* @param map
*/
-void _stp_map_clear(MAP map)
+static void _stp_map_clear(MAP map)
{
struct map_node *m;
@@ -351,7 +351,7 @@ void _stp_map_clear(MAP map)
}
}
-void _stp_pmap_clear(PMAP pmap)
+static void _stp_pmap_clear(PMAP pmap)
{
int i;
@@ -393,7 +393,7 @@ static void __stp_map_del(MAP map)
* @param map
*/
-void _stp_map_del(MAP map)
+static void _stp_map_del(MAP map)
{
if (map == NULL)
return;
@@ -403,7 +403,7 @@ void _stp_map_del(MAP map)
_stp_kfree(map);
}
-void _stp_pmap_del(PMAP pmap)
+static void _stp_pmap_del(PMAP pmap)
{
int i;
@@ -510,7 +510,7 @@ static inline void _stp_swap (struct list_head *a, struct list_head *b)
* @sa _stp_map_sortn()
*/
-void _stp_map_sort (MAP map, int keynum, int dir)
+static void _stp_map_sort (MAP map, int keynum, int dir)
{
struct list_head *p, *q, *e, *tail;
int nmerges, psize, qsize, i, type, insize = 1;
@@ -577,7 +577,7 @@ void _stp_map_sort (MAP map, int keynum, int dir)
* @param dir Sort Direction. -1 for low-to-high. 1 for high-to-low.
* @sa _stp_map_sort()
*/
-void _stp_map_sortn(MAP map, int n, int keynum, int dir)
+static void _stp_map_sortn(MAP map, int n, int keynum, int dir)
{
if (n == 0 || n > 30) {
_stp_map_sort(map, keynum, dir);
@@ -726,7 +726,7 @@ static void _stp_add_agg(struct map_node *aptr, struct map_node *ptr)
* @param map A pointer to a pmap.
* @returns a pointer to the aggregated map. Null on failure.
*/
-MAP _stp_pmap_agg (PMAP pmap)
+static MAP _stp_pmap_agg (PMAP pmap)
{
int i, hash;
MAP m, agg;
@@ -912,7 +912,7 @@ static int _new_map_set_stat (MAP map, struct map_node *n, int64_t val, int add)
* @param pmap
* @returns an int
*/
-int _stp_pmap_size (PMAP pmap)
+static int _stp_pmap_size (PMAP pmap)
{
int i, num = 0;
diff --git a/runtime/map.h b/runtime/map.h
index 6cd6e119..6c1c855b 100644
--- a/runtime/map.h
+++ b/runtime/map.h
@@ -166,34 +166,34 @@ typedef struct pmap *PMAP;
/** @cond DONT_INCLUDE */
/************* prototypes for map.c ****************/
-int int64_eq_p(int64_t key1, int64_t key2);
+static int int64_eq_p(int64_t key1, int64_t key2);
void int64_copy(void *dest, int64_t val);
void int64_add(void *dest, int64_t val);
int64_t int64_get(void *ptr);
void stat_copy(void *dest, stat *src);
void stat_add(void *dest, stat *src);
stat *stat_get(void *ptr);
-int64_t _stp_key_get_int64(struct map_node *mn, int n);
-char * _stp_key_get_str(struct map_node *mn, int n);
-unsigned int int64_hash(const int64_t v);
+static int64_t _stp_key_get_int64(struct map_node *mn, int n);
+static char * _stp_key_get_str(struct map_node *mn, int n);
+static unsigned int int64_hash(const int64_t v);
char * str_get(void *ptr);
-void str_copy(char *dest, char *src);
-void str_add(void *dest, char *val);
-int str_eq_p(char *key1, char *key2);
-int64_t _stp_get_int64(struct map_node *m);
-char * _stp_get_str(struct map_node *m);
-stat *_stp_get_stat(struct map_node *m);
-unsigned int str_hash(const char *key1);
+static void str_copy(char *dest, char *src);
+static void str_add(void *dest, char *val);
+static int str_eq_p(char *key1, char *key2);
+static int64_t _stp_get_int64(struct map_node *m);
+static char * _stp_get_str(struct map_node *m);
+static stat *_stp_get_stat(struct map_node *m);
+static unsigned int str_hash(const char *key1);
static MAP _stp_map_new(unsigned max_entries, int type, int key_size, int data_size);
static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data_size);
static int msb64(int64_t x);
static MAP _stp_map_new_hstat_log(unsigned max_entries, int key_size);
static MAP _stp_map_new_hstat_linear(unsigned max_entries, int ksize, int start, int stop, int interval);
static void _stp_map_print_histogram(MAP map, stat *s);
-struct map_node * _stp_map_start(MAP map);
-struct map_node * _stp_map_iter(MAP map, struct map_node *m);
-void _stp_map_del(MAP map);
-void _stp_map_clear(MAP map);
+static struct map_node * _stp_map_start(MAP map);
+static struct map_node * _stp_map_iter(MAP map, struct map_node *m);
+static void _stp_map_del(MAP map);
+static void _stp_map_clear(MAP map);
void _stp_map_print(MAP map, const char *fmt);
static struct map_node *_new_map_create (MAP map, struct hlist_head *head);
diff --git a/runtime/perf.c b/runtime/perf.c
index 0b812630..9ac8b481 100644
--- a/runtime/perf.c
+++ b/runtime/perf.c
@@ -59,7 +59,7 @@ static struct pfarg_start start_args;
* @param pmd_count, number of entries in pmd
* @returns an int, 0 if no errors encountered during setup
*/
-int _stp_perfmon_setup(void **desc,
+static int _stp_perfmon_setup(void **desc,
struct pfarg_ctx *context,
struct pfarg_pmc pmc[], int pmc_count,
struct pfarg_pmd pmd[], int pmd_count)
@@ -98,7 +98,7 @@ cleanup: *desc=NULL;
* @param desc unique pointer to describe configuration
* @returns an int, 0 if no errors encountered during shutdown
*/
-int _stp_perfmon_shutdown(void *desc)
+static int _stp_perfmon_shutdown(void *desc)
{
int err=0;
@@ -116,7 +116,7 @@ int _stp_perfmon_shutdown(void *desc)
* @param desc unique pointer to describe configuration
* @returns an int64, raw value of counter
*/
-int64_t _stp_perfmon_read(void *desc, int counter)
+static int64_t _stp_perfmon_read(void *desc, int counter)
{
struct pfarg_pmd storage;
diff --git a/runtime/perf.h b/runtime/perf.h
index e3212228..6a87bff0 100644
--- a/runtime/perf.h
+++ b/runtime/perf.h
@@ -15,13 +15,13 @@
* @brief Header file for performance monitoring hardware support
*/
-int _stp_perfmon_setup(void **desc,
+static int _stp_perfmon_setup(void **desc,
struct pfarg_ctx *context,
struct pfarg_pmc pmc[], int pmc_count,
struct pfarg_pmd pmd[], int pmd_count);
-int _stp_perfmon_shutdown(void *desc);
+static int _stp_perfmon_shutdown(void *desc);
-int64_t _stp_perfmon_read(void *desc, int counter);
+static int64_t _stp_perfmon_read(void *desc, int counter);
#endif /* _PERF_H_ */
diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c
index 7f7ddeb0..86c3dc42 100644
--- a/runtime/pmap-gen.c
+++ b/runtime/pmap-gen.c
@@ -400,7 +400,7 @@ static unsigned int KEYSYM(phash) (ALLKEYSD(key))
#if VALUE_TYPE == INT64 || VALUE_TYPE == STRING
-PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries)
+static PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries)
{
PMAP pmap = _stp_pmap_new (max_entries, VALUE_TYPE, sizeof(struct KEYSYM(pmap_node)), 0);
if (pmap) {
@@ -426,7 +426,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries)
/* _stp_pmap_new_key1_key2...val (num, HIST_LINEAR, start, end, interval) */
/* _stp_pmap_new_key1_key2...val (num, HIST_LOG) */
-PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...)
+static PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...)
{
int start=0, stop=0, interval=0;
PMAP pmap;
@@ -477,7 +477,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...)
}
#endif /* VALUE_TYPE */
-int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add)
+static int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add)
{
unsigned int hv;
struct hlist_head *head;
@@ -522,7 +522,7 @@ int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add)
return MAP_SET_VAL(map,(struct map_node *)n, val, 0);
}
-int KEYSYM(_stp_pmap_set) (PMAP pmap, ALLKEYSD(key), VSTYPE val)
+static int KEYSYM(_stp_pmap_set) (PMAP pmap, ALLKEYSD(key), VSTYPE val)
{
int res;
MAP m = per_cpu_ptr (pmap->map, MAP_GET_CPU ());
@@ -538,7 +538,7 @@ int KEYSYM(_stp_pmap_set) (PMAP pmap, ALLKEYSD(key), VSTYPE val)
return res;
}
-int KEYSYM(_stp_pmap_add) (PMAP pmap, ALLKEYSD(key), VSTYPE val)
+static int KEYSYM(_stp_pmap_add) (PMAP pmap, ALLKEYSD(key), VSTYPE val)
{
int res;
MAP m = per_cpu_ptr (pmap->map, MAP_GET_CPU());
@@ -555,7 +555,7 @@ int KEYSYM(_stp_pmap_add) (PMAP pmap, ALLKEYSD(key), VSTYPE val)
}
-VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key))
+static VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key))
{
unsigned int hv;
struct hlist_head *head;
@@ -608,7 +608,7 @@ VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key))
return NULLRET;
}
-VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key))
+static VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key))
{
unsigned int hv;
int cpu, clear_agg = 0;
@@ -696,7 +696,7 @@ VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key))
return NULLRET;
}
-int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key))
+static int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key))
{
unsigned int hv;
struct hlist_head *head;
@@ -737,7 +737,7 @@ int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key))
return 0;
}
-int KEYSYM(_stp_pmap_del) (PMAP pmap, ALLKEYSD(key))
+static int KEYSYM(_stp_pmap_del) (PMAP pmap, ALLKEYSD(key))
{
int res;
MAP m = per_cpu_ptr (pmap->map, MAP_GET_CPU ());
diff --git a/runtime/print.c b/runtime/print.c
index 14a0820b..54919876 100644
--- a/runtime/print.c
+++ b/runtime/print.c
@@ -39,16 +39,16 @@ typedef struct __stp_pbuf {
char buf[STP_BUFFER_SIZE];
} _stp_pbuf;
-void *Stp_pbuf = NULL;
+static void *Stp_pbuf = NULL;
/** private buffer for _stp_log() */
#define STP_LOG_BUF_LEN 256
typedef char _stp_lbuf[STP_LOG_BUF_LEN];
-void *Stp_lbuf = NULL;
+static void *Stp_lbuf = NULL;
/* create percpu print and io buffers */
-int _stp_print_init (void)
+static int _stp_print_init (void)
{
Stp_pbuf = _stp_alloc_percpu(sizeof(_stp_pbuf));
if (unlikely(Stp_pbuf == 0))
@@ -63,7 +63,7 @@ int _stp_print_init (void)
return 0;
}
-void _stp_print_cleanup (void)
+static void _stp_print_cleanup (void)
{
if (Stp_pbuf)
_stp_free_percpu(Stp_pbuf);
@@ -171,7 +171,7 @@ static void _stp_print_binary (int num, ...)
*
* @sa _stp_print_flush()
*/
-void _stp_printf (const char *fmt, ...)
+static void _stp_printf (const char *fmt, ...)
{
int num;
va_list args;
@@ -207,7 +207,7 @@ void _stp_printf (const char *fmt, ...)
* @param str A C string (char *)
*/
-void _stp_print (const char *str)
+static void _stp_print (const char *str)
{
_stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
char *end = pb->buf + STP_BUFFER_SIZE;
@@ -231,7 +231,7 @@ void _stp_print (const char *str)
pb->len = ptr - pb->buf;
}
-void _stp_print_char (const char c)
+static void _stp_print_char (const char c)
{
char *buf;
_stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id());
@@ -274,7 +274,7 @@ static char *next_fmt(char *fmt, int *num)
return f;
}
-void _stp_print_kernel_info(char *vstr, int ctx, int num_probes)
+static void _stp_print_kernel_info(char *vstr, int ctx, int num_probes)
{
#ifdef DEBUG_MEM
printk(KERN_DEBUG "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u+%u data+text+ctx+net+alloc, probes: %d\n",
diff --git a/runtime/print_new.c b/runtime/print_new.c
index 4136ecbe..fa7b4727 100644
--- a/runtime/print_new.c
+++ b/runtime/print_new.c
@@ -16,7 +16,7 @@
* @note Preemption must be disabled to use this.
*/
-DEFINE_SPINLOCK(_stp_print_lock);
+static DEFINE_SPINLOCK(_stp_print_lock);
void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb)
{
diff --git a/runtime/procfs.c b/runtime/procfs.c
index 0fe22aba..98d0af98 100644
--- a/runtime/procfs.c
+++ b/runtime/procfs.c
@@ -22,7 +22,7 @@ static struct proc_dir_entry *_stp_procfs_files[STP_MAX_PROCFS_FILES];
static struct proc_dir_entry *_stp_proc_stap = NULL;
static struct proc_dir_entry *_stp_proc_root = NULL;
-void _stp_close_procfs(void);
+static void _stp_close_procfs(void);
// 2.6.24 fixed proc_dir_entry refcounting.
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
@@ -34,7 +34,7 @@ void _stp_close_procfs(void);
/*
* Removes /proc/systemtap/{module_name} and /proc/systemtap (if empty)
*/
-void _stp_rmdir_proc_module(void)
+static void _stp_rmdir_proc_module(void)
{
if (_stp_proc_root && _stp_proc_root->subdir == NULL) {
if (atomic_read(&_stp_proc_root->count) != LAST_ENTRY_COUNT)
@@ -71,7 +71,7 @@ void _stp_rmdir_proc_module(void)
* Safely creates /proc/systemtap (if necessary) and
* /proc/systemtap/{module_name}.
*/
-int _stp_mkdir_proc_module(void)
+static int _stp_mkdir_proc_module(void)
{
if (_stp_proc_root == NULL) {
struct nameidata nd;
@@ -128,7 +128,7 @@ static struct proc_dir_entry *_stp_procfs_lookup(const char *dir, struct proc_di
return NULL;
}
-int _stp_create_procfs(const char *path, int num)
+static int _stp_create_procfs(const char *path, int num)
{
const char *p;
char *next;
@@ -195,7 +195,7 @@ err:
return -1;
}
-void _stp_close_procfs(void)
+static void _stp_close_procfs(void)
{
int i;
for (i = _stp_num_pde-1; i >= 0; i--) {
diff --git a/runtime/regs.c b/runtime/regs.c
index 81b865b1..2f7c741d 100644
--- a/runtime/regs.c
+++ b/runtime/regs.c
@@ -31,7 +31,7 @@
* @note i386 and x86_64 only so far.
*/
-unsigned long _stp_ret_addr (struct pt_regs *regs)
+static unsigned long _stp_ret_addr (struct pt_regs *regs)
{
#if defined (STAPCONF_X86_UNIREGS) && (defined (__x86_64__) || defined (__i386__))
unsigned long *ra = (unsigned long *)regs->sp;
@@ -85,7 +85,7 @@ unsigned long _stp_ret_addr (struct pt_regs *regs)
#if defined (STAPCONF_X86_UNIREGS) && defined (__x86_64__)
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
unsigned int fsindex,gsindex;
@@ -126,7 +126,7 @@ void _stp_print_regs(struct pt_regs * regs)
#elif defined (STAPCONF_X86_UNIREGS) && defined (__i386__)
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
@@ -153,7 +153,7 @@ void _stp_print_regs(struct pt_regs * regs)
}
#elif defined (__x86_64__)
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
unsigned int fsindex,gsindex;
@@ -193,7 +193,7 @@ void _stp_print_regs(struct pt_regs * regs)
}
#elif defined (__ia64__)
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
@@ -228,7 +228,7 @@ void _stp_print_regs(struct pt_regs * regs)
* @param regs The pt_regs saved by the kprobe.
* @note i386 and x86_64 only so far.
*/
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
@@ -263,7 +263,7 @@ static int _stp_probing_32bit_app(struct pt_regs *regs)
return (user_mode(regs) && test_tsk_thread_flag(current, TIF_32BIT));
}
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
int i;
@@ -302,7 +302,7 @@ static const char *processor_modes[]=
};
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
unsigned long flags = condition_codes(regs);
@@ -365,7 +365,7 @@ void _stp_print_regs(struct pt_regs * regs)
#define GPRSIZE "%08lX "
#endif
-void _stp_print_regs(struct pt_regs * regs)
+static void _stp_print_regs(struct pt_regs * regs)
{
char *mode;
int i;
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 3b3e117d..fc5d454f 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -44,7 +44,7 @@
#endif
static void _stp_dbug (const char *func, int line, const char *fmt, ...);
-void _stp_error (const char *fmt, ...);
+static void _stp_error (const char *fmt, ...);
#include "debug.h"
@@ -93,7 +93,7 @@ static struct
#include "addr-map.c"
/* Support functions for int64_t module parameters. */
-int param_set_int64_t(const char *val, struct kernel_param *kp)
+static int param_set_int64_t(const char *val, struct kernel_param *kp)
{
char *endp;
long long ll;
@@ -114,7 +114,7 @@ int param_set_int64_t(const char *val, struct kernel_param *kp)
return 0;
}
-int param_get_int64_t(char *buffer, struct kernel_param *kp)
+static int param_get_int64_t(char *buffer, struct kernel_param *kp)
{
return sprintf(buffer, "%lli", (long long)*((int64_t *)kp->arg));
}
@@ -129,7 +129,7 @@ int init_module (void)
return _stp_transport_init();
}
-int probe_start(void);
+static int probe_start(void);
void cleanup_module(void)
{
diff --git a/runtime/stack.c b/runtime/stack.c
index 23ac2edc..7ca0e316 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -47,7 +47,7 @@
* @param regs A pointer to the struct pt_regs.
*/
-void _stp_stack_print(struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels)
+static void _stp_stack_print(struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels)
{
if (verbose) {
/* print the current address */
@@ -75,7 +75,7 @@ void _stp_stack_print(struct pt_regs *regs, int verbose, struct kretprobe_instan
* @param regs A pointer to the struct pt_regs.
* @returns void
*/
-void _stp_stack_snprint(char *str, int size, struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels)
+static void _stp_stack_snprint(char *str, int size, struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels)
{
/* To get a string, we use a simple trick. First flush the print buffer, */
/* then call _stp_stack_print, then copy the result into the output string */
@@ -93,7 +93,7 @@ void _stp_stack_snprint(char *str, int size, struct pt_regs *regs, int verbose,
* @note Currently limited to a depth of two. Works from jprobes and kprobes.
*/
#if 0
-void _stp_ustack_print(char *str)
+static void _stp_ustack_print(char *str)
{
struct pt_regs *nregs = ((struct pt_regs *)(THREAD_SIZE + (unsigned long)current->thread_info)) - 1;
_stp_printf("%p : [user]\n", (int64_t) REG_IP(nregs));
diff --git a/runtime/stat.c b/runtime/stat.c
index e40a4f2d..689a84fe 100644
--- a/runtime/stat.c
+++ b/runtime/stat.c
@@ -74,7 +74,7 @@ typedef struct _Stat *Stat;
* @param stop - An integer. The stopping value. Should be > start.
* @param interval - An integer. The interval.
*/
-Stat _stp_stat_init (int type, ...)
+static Stat _stp_stat_init (int type, ...)
{
int size, buckets=0, start=0, stop=0, interval=0;
stat *sd, *agg;
@@ -141,7 +141,7 @@ exit1:
*
* @param st Stat
*/
-void _stp_stat_del (Stat st)
+static void _stp_stat_del (Stat st)
{
if (st) {
_stp_free_percpu (st->sd);
@@ -156,7 +156,7 @@ void _stp_stat_del (Stat st)
* @param st Stat
* @param val Value to add
*/
-void _stp_stat_add (Stat st, int64_t val)
+static void _stp_stat_add (Stat st, int64_t val)
{
stat *sd = per_cpu_ptr (st->sd, get_cpu());
STAT_LOCK(sd);
@@ -175,7 +175,7 @@ void _stp_stat_add (Stat st, int64_t val)
* @param cpu CPU number
* @returns A pointer to a stat.
*/
-stat *_stp_stat_get_cpu (Stat st, int cpu)
+static stat *_stp_stat_get_cpu (Stat st, int cpu)
{
stat *sd = per_cpu_ptr (st->sd, cpu);
STAT_LOCK(sd);
@@ -203,7 +203,7 @@ static void _stp_stat_clear_data (Stat st, stat *sd)
* for polling.
* @returns A pointer to a stat.
*/
-stat *_stp_stat_get (Stat st, int clear)
+static stat *_stp_stat_get (Stat st, int clear)
{
int i, j;
stat *agg = st->agg;
@@ -242,7 +242,7 @@ stat *_stp_stat_get (Stat st, int clear)
*
* @param st Stat
*/
-void _stp_stat_clear (Stat st)
+static void _stp_stat_clear (Stat st)
{
int i;
stp_for_each_cpu(i) {
diff --git a/runtime/string.c b/runtime/string.c
index 13c46dda..c087c783 100644
--- a/runtime/string.c
+++ b/runtime/string.c
@@ -28,7 +28,7 @@
* variable number of args.
*/
-int _stp_snprintf(char *buf, size_t size, const char *fmt, ...)
+static int _stp_snprintf(char *buf, size_t size, const char *fmt, ...)
{
va_list args;
int i;
@@ -39,7 +39,7 @@ int _stp_snprintf(char *buf, size_t size, const char *fmt, ...)
return i;
}
-int _stp_vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
+static int _stp_vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
unsigned i = _stp_vsnprintf(buf,size,fmt,args);
return (i >= size) ? (size - 1) : i;
@@ -60,7 +60,7 @@ int _stp_vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
* in will have "..." after the second quote.
* @param user Set this to indicate the input string pointer is a userspace pointer.
*/
-void _stp_text_str(char *outstr, char *in, int len, int quoted, int user)
+static void _stp_text_str(char *outstr, char *in, int len, int quoted, int user)
{
const int length = len;
char c, *out = outstr;
diff --git a/runtime/string.h b/runtime/string.h
index 6106b009..c955da6c 100644
--- a/runtime/string.h
+++ b/runtime/string.h
@@ -13,8 +13,8 @@
static char _stp_stdout[] = "_stdout_";
#define to_oct_digit(c) ((c) + '0')
-void _stp_vsprintf (char *str, const char *fmt, va_list args);
-void _stp_text_str(char *out, char *in, int len, int quoted, int user);
+static void _stp_vsprintf (char *str, const char *fmt, va_list args);
+static void _stp_text_str(char *out, char *in, int len, int quoted, int user);
/*
* Powerpc uses a paranoid user address check in __get_user() which
diff --git a/runtime/sym.c b/runtime/sym.c
index 06ac14a5..62c9f3ce 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -21,7 +21,7 @@
*/
/* XXX: this needs to be address-space-specific. */
-unsigned long _stp_module_relocate(const char *module, const char *section, unsigned long offset)
+static unsigned long _stp_module_relocate(const char *module, const char *section, unsigned long offset)
{
static struct _stp_module *last = NULL;
static struct _stp_section *last_sec;
@@ -236,7 +236,7 @@ static int _stp_module_check(void)
* a probe because it is too time-consuming. Use at module exit time.
*/
-void _stp_symbol_print(unsigned long address)
+static void _stp_symbol_print(unsigned long address)
{
const char *modname;
const char *name;
@@ -255,7 +255,7 @@ void _stp_symbol_print(unsigned long address)
}
/* Like _stp_symbol_print, except only print if the address is a valid function address */
-int _stp_func_print(unsigned long address, int verbose, int exact)
+static int _stp_func_print(unsigned long address, int verbose, int exact)
{
const char *modname;
const char *name;
@@ -283,7 +283,7 @@ int _stp_func_print(unsigned long address, int verbose, int exact)
return 0;
}
-void _stp_symbol_snprint(char *str, size_t len, unsigned long address)
+static void _stp_symbol_snprint(char *str, size_t len, unsigned long address)
{
const char *modname;
const char *name;
diff --git a/runtime/sym.h b/runtime/sym.h
index 9d6a4ded..e642cab4 100644
--- a/runtime/sym.h
+++ b/runtime/sym.h
@@ -54,15 +54,15 @@ struct _stp_module {
/* Defined by translator-generated stap-symbols.h. */
-struct _stp_module *_stp_modules [];
-unsigned _stp_num_modules;
+static struct _stp_module *_stp_modules [];
+static unsigned _stp_num_modules;
/* the number of modules in the arrays */
static unsigned long _stp_kretprobe_trampoline = 0;
-unsigned long _stp_module_relocate (const char *module, const char *section, unsigned long offset);
+static unsigned long _stp_module_relocate (const char *module, const char *section, unsigned long offset);
static struct _stp_module *_stp_get_unwind_info (unsigned long addr);
#endif /* _STP_SYM_H_ */
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index f982eef1..d9a4cedb 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -22,14 +22,14 @@ struct stap_task_finder_target;
#define __STP_TF_RUNNING 1
#define __STP_TF_STOPPING 2
#define __STP_TF_STOPPED 3
-atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING);
-atomic_t __stp_inuse_count = ATOMIC_INIT (0);
+static atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING);
+static atomic_t __stp_inuse_count = ATOMIC_INIT (0);
#define __stp_tf_handler_start() (atomic_inc(&__stp_inuse_count))
#define __stp_tf_handler_end() (atomic_dec(&__stp_inuse_count))
#ifdef DEBUG_TASK_FINDER
-atomic_t __stp_attach_count = ATOMIC_INIT (0);
+static atomic_t __stp_attach_count = ATOMIC_INIT (0);
#define debug_task_finder_attach() (atomic_inc(&__stp_attach_count))
#define debug_task_finder_detach() (atomic_dec(&__stp_attach_count))
@@ -56,7 +56,7 @@ typedef int (*stap_task_finder_vm_callback)(struct stap_task_finder_target *tgt,
unsigned long vm_pgoff);
#ifdef DEBUG_TASK_FINDER_VMA
-int __stp_tf_vm_cb(struct stap_task_finder_target *tgt,
+static int __stp_tf_vm_cb(struct stap_task_finder_target *tgt,
struct task_struct *tsk,
int map_p, char *vm_path,
unsigned long vm_start,
@@ -907,7 +907,7 @@ utftq_out:
}
-struct vm_area_struct *
+static struct vm_area_struct *
__stp_find_file_based_vma(struct mm_struct *mm, unsigned long addr)
{
struct vm_area_struct *vma = find_vma(mm, addr);
@@ -1208,7 +1208,7 @@ struct utrace_engine_ops __stp_utrace_task_finder_ops = {
.report_death = stap_utrace_task_finder_report_death,
};
-int
+static int
stap_start_task_finder(void)
{
int rc = 0;
diff --git a/runtime/time.c b/runtime/time.c
index 15e205dd..ad7cef9d 100644
--- a/runtime/time.c
+++ b/runtime/time.c
@@ -54,10 +54,10 @@ typedef struct __stp_time_t {
struct timer_list timer;
} stp_time_t;
-void *stp_time = NULL;
+static void *stp_time = NULL;
/* Flag to tell the timer callback whether to reregister */
-int stp_timer_reregister = 0;
+static int stp_timer_reregister = 0;
/* Try to estimate the number of CPU cycles in a millisecond - i.e. kHz. This
* relies heavily on the accuracy of udelay. By calling udelay twice, we
@@ -185,7 +185,7 @@ __stp_time_cpufreq_callback(struct notifier_block *self,
return NOTIFY_OK;
}
-struct notifier_block __stp_time_notifier = {
+static struct notifier_block __stp_time_notifier = {
.notifier_call = __stp_time_cpufreq_callback,
};
@@ -205,7 +205,7 @@ __stp_constant_freq(void)
#endif /* CONFIG_CPU_FREQ */
/* This function is called during module unloading. */
-void
+static void
_stp_kill_time(void)
{
if (stp_time) {
@@ -227,7 +227,7 @@ _stp_kill_time(void)
}
/* This function is called during module loading. */
-int
+static int
_stp_init_time(void)
{
int ret = 0;
@@ -268,7 +268,7 @@ _stp_init_time(void)
return ret;
}
-int64_t
+static int64_t
_stp_gettimeofday_ns(void)
{
int64_t base;
diff --git a/runtime/transport/control.c b/runtime/transport/control.c
index 7d78cca4..93db97e1 100644
--- a/runtime/transport/control.c
+++ b/runtime/transport/control.c
@@ -14,7 +14,7 @@ static int _stp_current_buffers = STP_DEFAULT_BUFFERS;
static _stp_mempool_t *_stp_pool_q;
static struct list_head _stp_ctl_ready_q;
-DEFINE_SPINLOCK(_stp_ctl_ready_lock);
+static DEFINE_SPINLOCK(_stp_ctl_ready_lock);
static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
diff --git a/runtime/transport/relayfs.c b/runtime/transport/relayfs.c
index 6c516d66..5bd3ff4d 100644
--- a/runtime/transport/relayfs.c
+++ b/runtime/transport/relayfs.c
@@ -77,7 +77,7 @@ static void _stp_remove_relay_root(struct dentry *root)
}
}
-struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts)
+static struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts)
{
struct utt_trace *utt;
int i;
@@ -122,13 +122,13 @@ err:
return NULL;
}
-void utt_set_overwrite(int overwrite)
+static void utt_set_overwrite(int overwrite)
{
if (_stp_utt)
_stp_utt->rchan->overwrite = overwrite;
}
-int utt_trace_startstop(struct utt_trace *utt, int start,
+static int utt_trace_startstop(struct utt_trace *utt, int start,
unsigned int *trace_seq)
{
int ret;
@@ -163,7 +163,7 @@ int utt_trace_startstop(struct utt_trace *utt, int start,
}
-int utt_trace_remove(struct utt_trace *utt)
+static int utt_trace_remove(struct utt_trace *utt)
{
dbug_trans(1, "removing relayfs files. %d\n", utt->trace_state);
if (utt && (utt->trace_state == Utt_trace_setup || utt->trace_state == Utt_trace_stopped)) {
diff --git a/runtime/transport/relayfs.h b/runtime/transport/relayfs.h
index c47f4b98..c33e9b08 100644
--- a/runtime/transport/relayfs.h
+++ b/runtime/transport/relayfs.h
@@ -16,11 +16,11 @@
# include <linux/namei.h>
-struct rchan *_stp_relayfs_open(unsigned n_subbufs,
+static struct rchan *_stp_relayfs_open(unsigned n_subbufs,
unsigned subbuf_size,
int pid,
struct dentry **outdir);
-void _stp_relayfs_close(struct rchan *chan, struct dentry *dir);
+static void _stp_relayfs_close(struct rchan *chan, struct dentry *dir);
#endif /* _TRANSPORT_RELAYFS_H_ */
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 72f9ad80..b9458ada 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -103,7 +103,7 @@ static void generic_swap(void *a, void *b, int size)
* O(n*n) worst-case behavior and extra memory requirements that make
* it less suitable for kernel use.
*/
-void _stp_sort(void *_base, size_t num, size_t size,
+static void _stp_sort(void *_base, size_t num, size_t size,
int (*cmp_func) (const void *, const void *), void (*swap_func) (void *, void *, int size))
{
char *base = (char*) _base;
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index f5ee2c36..a572ef9c 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -25,9 +25,9 @@
static struct utt_trace *_stp_utt = NULL;
static unsigned int utt_seq = 1;
static int _stp_probes_started = 0;
-pid_t _stp_target = 0;
+static pid_t _stp_target = 0;
static int _stp_exit_called = 0;
-int _stp_exit_flag = 0;
+static int _stp_exit_flag = 0;
#ifdef STP_OLD_TRANSPORT
#include "relayfs.c"
#include "procfs.c"
@@ -42,9 +42,9 @@ module_param(_stp_bufsize, int, 0);
MODULE_PARM_DESC(_stp_bufsize, "buffer size");
/* forward declarations */
-void probe_exit(void);
-int probe_start(void);
-void _stp_exit(void);
+static void probe_exit(void);
+static int probe_start(void);
+static void _stp_exit(void);
/* check for new workqueue API */
#ifdef DECLARE_DELAYED_WORK
@@ -61,7 +61,7 @@ static struct workqueue_struct *_stp_wq;
* _stp_handle_start - handle STP_START
*/
-void _stp_handle_start(struct _stp_msg_start *st)
+static void _stp_handle_start(struct _stp_msg_start *st)
{
dbug_trans(1, "stp_handle_start\n");
_stp_target = st->target;
@@ -170,7 +170,7 @@ static void _stp_work_queue(void *data)
* This is called automatically when the module is unloaded.
*
*/
-void _stp_transport_close()
+static void _stp_transport_close()
{
dbug_trans(1, "%d: ************** transport_close *************\n", current->pid);
_stp_cleanup_and_exit(0);
@@ -205,7 +205,7 @@ static struct utt_trace *_stp_utt_open(void)
* _stp_transport_init() is called from the module initialization.
* It does the bare minimum to exchange commands with staprun
*/
-int _stp_transport_init(void)
+static int _stp_transport_init(void)
{
int ret;
diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h
index 421a65c2..11a070de 100644
--- a/runtime/transport/transport.h
+++ b/runtime/transport/transport.h
@@ -26,20 +26,20 @@
static unsigned _stp_nsubbufs = 8;
static unsigned _stp_subbuf_size = 65536*4;
-void _stp_warn (const char *fmt, ...);
-extern void _stp_transport_close(void);
-extern int _stp_print_init(void);
-extern void _stp_print_cleanup(void);
+static void _stp_warn (const char *fmt, ...);
+static void _stp_transport_close(void);
+static int _stp_print_init(void);
+static void _stp_print_cleanup(void);
static struct dentry *_stp_get_root_dir(const char *name);
static int _stp_lock_debugfs(void);
static void _stp_unlock_debugfs(void);
static void _stp_attach(void);
static void _stp_detach(void);
-void _stp_handle_start(struct _stp_msg_start *st);
+static void _stp_handle_start(struct _stp_msg_start *st);
-int _stp_pid = 0;
-uid_t _stp_uid = 0;
-gid_t _stp_gid = 0;
-pid_t _stp_init_pid = 0;
-int _stp_attached = 0;
+static int _stp_pid = 0;
+static uid_t _stp_uid = 0;
+static gid_t _stp_gid = 0;
+static pid_t _stp_init_pid = 0;
+static int _stp_attached = 0;
#endif /* _TRANSPORT_TRANSPORT_H_ */
diff --git a/runtime/transport/utt.c b/runtime/transport/utt.c
index 21d2ab8a..59060474 100644
--- a/runtime/transport/utt.c
+++ b/runtime/transport/utt.c
@@ -37,7 +37,7 @@ static int utt_overwrite_flag = 0;
*
* Most of this function is deadcopy of relay_switch_subbuf.
*/
-size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf,
+static size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf,
size_t length)
{
char *old, *new;
@@ -122,7 +122,7 @@ static void __utt_timer_init(struct utt_trace * utt)
add_timer(&utt->timer);
}
-void utt_set_overwrite(int overwrite)
+static void utt_set_overwrite(int overwrite)
{
utt_overwrite_flag = overwrite;
}
@@ -170,7 +170,7 @@ err:
}
-void utt_trace_cleanup(struct utt_trace *utt)
+static void utt_trace_cleanup(struct utt_trace *utt)
{
if (utt == NULL)
return;
@@ -182,7 +182,7 @@ void utt_trace_cleanup(struct utt_trace *utt)
_stp_kfree(utt);
}
-int utt_trace_remove(struct utt_trace *utt)
+static int utt_trace_remove(struct utt_trace *utt)
{
if (utt->trace_state == Utt_trace_setup ||
utt->trace_state == Utt_trace_stopped)
@@ -288,7 +288,7 @@ static struct rchan_callbacks utt_relay_callbacks_global = {
/*
* Setup everything required to start tracing
*/
-struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts)
+static struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts)
{
struct utt_trace *utt = NULL;
struct dentry *dir = NULL;
@@ -373,7 +373,7 @@ err:
return NULL;
}
-int utt_trace_startstop(struct utt_trace *utt, int start,
+static int utt_trace_startstop(struct utt_trace *utt, int start,
unsigned int *trace_seq)
{
int ret;
diff --git a/runtime/transport/utt.h b/runtime/transport/utt.h
index df225b3c..40e54919 100644
--- a/runtime/transport/utt.h
+++ b/runtime/transport/utt.h
@@ -40,14 +40,14 @@ struct utt_trace_setup {
};
-extern struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts);
-extern int utt_trace_startstop(struct utt_trace *utt, int start,
+static struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts);
+static int utt_trace_startstop(struct utt_trace *utt, int start,
unsigned int *trace_seq);
-extern void utt_trace_cleanup(struct utt_trace *utt);
-extern int utt_trace_remove(struct utt_trace *utt);
+static void utt_trace_cleanup(struct utt_trace *utt);
+static int utt_trace_remove(struct utt_trace *utt);
#ifndef STP_OLD_TRANSPORT
-extern size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf,
+static size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf,
size_t length);
/**
* utt_reserve - reserve slot in channel buffer
diff --git a/runtime/unwind.c b/runtime/unwind.c
index bc8a93dc..c1362237 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -655,7 +655,7 @@ static const char *_stp_enc_lo_name[] = {
"DW_EH_PE_sdata4",
"DW_EH_PE_sdata8"
};
-char *_stp_eh_enc_name(signed type)
+static char *_stp_eh_enc_name(signed type)
{
static char buf[64];
int hi, low;
@@ -685,7 +685,7 @@ char *_stp_eh_enc_name(signed type)
/* Unwind to previous to frame. Returns 0 if successful, negative
* number in case of an error. A positive return means unwinding is finished;
* don't try to fallback to dumping addresses on the stack. */
-int unwind(struct unwind_frame_info *frame)
+static int unwind(struct unwind_frame_info *frame)
{
#define FRAME_REG(r, t) (((t *)frame)[reg_info[r].offs])
const u32 *fde, *cie = NULL;
diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c
index 2c3067cf..bd58d760 100644
--- a/runtime/vsprintf.c
+++ b/runtime/vsprintf.c
@@ -131,7 +131,7 @@ static int check_binary_precision (int precision) {
return precision;
}
-int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
+static int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
int len;
uint64_t num;