home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / a / bin / modules-.2 / modules- / modules-1.2.8 / insmod / insmod.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-30  |  2.6 KB  |  93 lines

  1. /*
  2.  * Install a module in the kernel.
  3.  *
  4.  * See the file COPYING for your rights (GNU GPL)
  5.  *
  6.  * Originally by Anonymous (as far as I know...)
  7.  * Linux version by Bas Laarhoven <bas@vimec.nl>
  8.  * Modified by Jon Tombs.
  9.  *
  10.  * Support for transient and resident symbols
  11.  * added by Bjorn Ekwall <bj0rn@blox.se> in 1994 (C)
  12.  *
  13.  * Load map option conceived by Derek Atkins <warlord@MIT.EDU>
  14.  *
  15.  * Support for versioned kernels and symbols: Bjorn Ekwall in December 1994
  16.  */
  17.  
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <errno.h>
  22. #include <a.out.h>
  23. #include <linux/elf.h>
  24. #include <sys/types.h>
  25. #include <sys/stat.h>
  26. #include <sys/utsname.h>
  27. #include <unistd.h>
  28. #include <linux/unistd.h>    /* Ehrm... well, well, well... */
  29. #include <linux/module.h>
  30. #include <fcntl.h>
  31.  
  32. #define TRANSIENT 2    /* flag that symbol was resolved by another module */
  33. #define DEF_BY_MODULE 1    /* flag that this is a define, _not_ a reference */
  34. #define RESIDENT 0    /* flag that symbol was resolved by resident kernel */
  35.  
  36. extern struct kernel_sym *load_syms(struct utsname *);
  37. extern int rmmod(int, char **);
  38. extern int ksyms(int, char **);
  39.  
  40. /*
  41.  * This is here as syscall.h and sys/syscall.h redefine the defines in
  42.  * unistd.h why doesn't unistd #include them?
  43.  */
  44.  
  45. #ifdef __cplusplus
  46. extern "C" int syscall(int, ...);
  47. #else
  48. extern int syscall(int, ...);
  49. #endif
  50.  
  51. #define symname(sp) (aout_flag?(sp->u.n.n_un.n_name):((char *)sp->u.e.st_name))
  52. #define symvalue(sp) (aout_flag?(sp->u.n.n_value):(sp->u.e.st_value))
  53. #define symother(sp) (aout_flag?(sp->u.n.n_other):(sp->u.e.st_other))
  54.  
  55. struct symbol {
  56.     union {
  57.         struct nlist n;
  58.         struct elf32_sym e;
  59.     } u;
  60.     struct symbol *child[2];
  61. };
  62.  
  63. /* hack: sizeof(struct elfhdr) > sizeof(struct exec) */
  64. extern Elf32_Ehdr header;
  65. extern int aout_flag;
  66. extern int elf_kernel;
  67. extern int verbose;
  68. extern char *load_aout(FILE *);
  69. extern void relocate_aout(FILE *, long);
  70. extern char *load_elf(FILE *);
  71. extern void relocate_elf(FILE *, long);
  72.  
  73. void *ckalloc(size_t);
  74. void hidesym(const char *);
  75. int defsym(int (*pfi)(const char *, const char *, size_t), const char *, unsigned long, int, int);
  76. struct symbol *findsym(const char *, struct symbol *, int (*pfi)(const char *, const char *, size_t));
  77. unsigned long looksym(const char *);
  78.  
  79. extern size_t codesize;
  80. extern size_t progsize;
  81. extern size_t bss1size;
  82. extern size_t bss2size;
  83. extern char *textseg;
  84. extern int nsymbols;
  85. struct symbol *symtab;
  86. extern char *stringtab;
  87. extern unsigned long addr;
  88.  
  89. /* error.c 29/05/95 21.43.42 */
  90. void insmod_setsyslog (const char *name);
  91. void insmod_error (const char *ctl, ...);
  92. void insmod_debug (const char *ctl, ...);
  93.