diff options
-rw-r--r-- | plugins/imklog/ksym.c | 70 | ||||
-rw-r--r-- | plugins/imklog/ksym_mod.c | 82 |
2 files changed, 8 insertions, 144 deletions
diff --git a/plugins/imklog/ksym.c b/plugins/imklog/ksym.c index baee2c05..e7b1eca7 100644 --- a/plugins/imklog/ksym.c +++ b/plugins/imklog/ksym.c @@ -1,6 +1,3 @@ -#include "config.h" - -#ifdef FEATURE_KLOGD /* ksym.c - functions for kernel address->symbol translation Copyright (c) 1995, 1996 Dr. G.W. Wettstein <greg@wind.rmcc.com> @@ -113,10 +110,15 @@ /* Includes. */ +#include "config.h" +#include <stdio.h> #include <stdlib.h> #include <sys/utsname.h> #include <ctype.h> -#include "klogd.h" +#include <stdarg.h> +#include <string.h> +#include <syslog.h> +#include "imklog.h" #include "ksyms.h" #define VERBOSE_DEBUGGING 0 @@ -920,67 +922,9 @@ extern char * ExpandKadds(line, el) * Return: void **************************************************************************/ -extern void SetParanoiaLevel(level) - - int level; - +extern void SetParanoiaLevel(int level) { i_am_paranoid = level; return; } - -/* - * Setting the -DTEST define enables the following code fragment to - * be compiled. This produces a small standalone program which will - * echo the standard input of the process to stdout while translating - * all numeric kernel addresses into their symbolic equivalent. - */ -#if defined(TEST) - -#include <stdarg.h> - -extern int main(int, char **); - - -extern int main(int argc, char *argv[]) -{ - auto char line[1024], eline[2048]; - - debugging = 1; - - - if ( !InitKsyms((char *) 0) ) - { - fputs("ksym: Error loading system map.\n", stderr); - return(1); - } - - while ( !feof(stdin) ) - { - fgets(line, sizeof(line), stdin); - if (line[strlen(line)-1] == '\n') line[strlen(line)-1] = '\0'; /* Trash NL char */ - memset(eline, '\0', sizeof(eline)); - ExpandKadds(line, eline); - fprintf(stdout, "%s\n", eline); - } - - - return(0); -} - -extern void Syslog(int priority, char *fmt, ...) - -{ - va_list ap; - - va_start(ap, fmt); - fprintf(stdout, "Pr: %d, ", priority); - vfprintf(stdout, fmt, ap); - va_end(ap); - fputc('\n', stdout); - - return; -} -#endif -#endif /* #ifdef FEATURE_KLOGD */ diff --git a/plugins/imklog/ksym_mod.c b/plugins/imklog/ksym_mod.c index 51ca2fb8..c7869720 100644 --- a/plugins/imklog/ksym_mod.c +++ b/plugins/imklog/ksym_mod.c @@ -1,6 +1,5 @@ +#if 0 #include "config.h" - -#ifdef FEATURE_KLOGD /* ksym_mod.c - functions for building symbol lookup tables for klogd Copyright (c) 1995, 1996 Dr. G.W. Wettstein <greg@wind.rmcc.com> @@ -469,17 +468,12 @@ static int AddModule(address, symbol) **************************************************************************/ static int AddSymbol(mp, address, symbol) - struct Module *mp; - unsigned long address; - char *symbol; - { auto int tmp; - /* Allocate space for the symbol table entry. */ mp->sym_array = (struct sym_table *) realloc(mp->sym_array, \ (mp->num_syms+1) * sizeof(struct sym_table)); @@ -526,17 +520,12 @@ static int AddSymbol(mp, address, symbol) **************************************************************************/ extern char * LookupModuleSymbol(value, sym) - unsigned long value; - struct symbol *sym; - { auto int nmod, nsym; - auto struct sym_table *last; - auto struct Module *mp; @@ -567,7 +556,6 @@ extern char * LookupModuleSymbol(value, sym) last = &mp->sym_array[nsym]; } - /* * At this stage of the game we still cannot give up the * ghost. There is the possibility that the address is @@ -633,72 +621,4 @@ extern char * LookupModuleSymbol(value, sym) /* It has been a hopeless exercise. */ return((char *) 0); } - - -/* - * Setting the -DTEST define enables the following code fragment to - * be compiled. This produces a small standalone program which will - * dump the current kernel symbol table. - */ -#if defined(TEST) - -#include <stdarg.h> - - -extern int main(int, char **); - - -int main(argc, argv) - - int argc; - - char *argv[]; - -{ - auto int lp, syms; - - - if ( !InitMsyms() ) - { - fprintf(stderr, "Cannot load module symbols.\n"); - return(1); - } - - printf("Number of modules: %d\n\n", num_modules); - - for(lp= 0; lp < num_modules; ++lp) - { - printf("Module #%d = %s, Number of symbols = %d\n", lp + 1, \ - sym_array_modules[lp].name, \ - sym_array_modules[lp].num_syms); - - for (syms= 0; syms < sym_array_modules[lp].num_syms; ++syms) - { - printf("\tSymbol #%d\n", syms + 1); - printf("\tName: %s\n", \ - sym_array_modules[lp].sym_array[syms].name); - printf("\tAddress: %lx\n\n", \ - sym_array_modules[lp].sym_array[syms].value); - } - } - - FreeModules(); - return(0); -} - -extern void Syslog(int priority, char *fmt, ...) - -{ - va_list ap; - - va_start(ap, fmt); - fprintf(stdout, "Pr: %d, ", priority); - vfprintf(stdout, fmt, ap); - va_end(ap); - fputc('\n', stdout); - - return; -} - #endif -#endif /* #ifdef FEATURE_KLOGD */ |