diff options
author | Andrew Morton <akpm@osdl.org> | 2004-05-14 20:19:11 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-14 20:19:11 -0700 |
commit | bfb288f1177db455dca1387fd3b97e3b9b94b09c (patch) | |
tree | eda4543ec55d7ab6742ae375c89457e3724bf8b9 /kernel | |
parent | 017474ed123ac14187eef6a0d5b76becbce763e0 (diff) | |
download | history-bfb288f1177db455dca1387fd3b97e3b9b94b09c.tar.gz |
[PATCH] show last kernel-image symbol in /proc/kallsyms
From: Rusty Russell <rusty@rustcorp.com.au>
The current code doesn't show the last symbol (usually _einittext) in
/proc/kallsyms. The reason for this is subtle: s_start() returns an empty
string for position 0 (ignored by s_show()), and s_next() returns the first
symbol for position 1.
What should happen is that update_iter() for position 0 should fill in the
first symbol. Unfortunately, the get_ksymbol_core() fills in the symbol
information, *and* updates the iterator: we have to split these functions,
which we do by making it return the length of the name offset.
Then we can call get_ksymbol_core() without moving the iterator, meaning
that we can call it at position 0 (ie. s_start()).
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kallsyms.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index ab39819f0e342c..2fb55848fb2fd2 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -171,21 +171,23 @@ static int get_ksymbol_mod(struct kallsym_iter *iter) return 1; } -static void get_ksymbol_core(struct kallsym_iter *iter) +/* Returns space to next name. */ +static unsigned long get_ksymbol_core(struct kallsym_iter *iter) { - unsigned stemlen; + unsigned stemlen, off = iter->nameoff; /* First char of each symbol name indicates prefix length shared with previous name (stem compression). */ - stemlen = kallsyms_names[iter->nameoff++]; + stemlen = kallsyms_names[off++]; - strlcpy(iter->name+stemlen, kallsyms_names+iter->nameoff, 128-stemlen); - iter->nameoff += strlen(kallsyms_names + iter->nameoff) + 1; + strlcpy(iter->name+stemlen, kallsyms_names + off, 128-stemlen); + off += strlen(kallsyms_names + off) + 1; iter->owner = NULL; iter->value = kallsyms_addresses[iter->pos]; iter->type = 't'; upcase_if_global(iter); + return off - iter->nameoff; } static void reset_iter(struct kallsym_iter *iter) @@ -210,9 +212,10 @@ static int update_iter(struct kallsym_iter *iter, loff_t pos) /* We need to iterate through the previous symbols: can be slow */ for (; iter->pos != pos; iter->pos++) { - get_ksymbol_core(iter); + iter->nameoff += get_ksymbol_core(iter); cond_resched(); } + get_ksymbol_core(iter); return 1; } |