user_syms.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #include "linux/types.h"
  2. #include "linux/module.h"
  3. /* Some of this are builtin function (some are not but could in the future),
  4. * so I *must* declare good prototypes for them and then EXPORT them.
  5. * The kernel code uses the macro defined by include/linux/string.h,
  6. * so I undef macros; the userspace code does not include that and I
  7. * add an EXPORT for the glibc one.
  8. */
  9. #undef strlen
  10. #undef strstr
  11. #undef memcpy
  12. #undef memset
  13. extern size_t strlen(const char *);
  14. extern void *memmove(void *, const void *, size_t);
  15. extern void *memset(void *, int, size_t);
  16. extern int printf(const char *, ...);
  17. /* If it's not defined, the export is included in lib/string.c.*/
  18. #ifdef __HAVE_ARCH_STRSTR
  19. EXPORT_SYMBOL(strstr);
  20. #endif
  21. #ifndef __x86_64__
  22. extern void *memcpy(void *, const void *, size_t);
  23. EXPORT_SYMBOL(memcpy);
  24. #endif
  25. EXPORT_SYMBOL(memmove);
  26. EXPORT_SYMBOL(memset);
  27. EXPORT_SYMBOL(printf);
  28. /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
  29. * However, the modules will use the CRC defined *here*, no matter if it is
  30. * good; so the versions of these symbols will always match
  31. */
  32. #define EXPORT_SYMBOL_PROTO(sym) \
  33. int sym(void); \
  34. EXPORT_SYMBOL(sym);
  35. extern void readdir64(void) __attribute__((weak));
  36. EXPORT_SYMBOL(readdir64);
  37. extern void truncate64(void) __attribute__((weak));
  38. EXPORT_SYMBOL(truncate64);
  39. #ifdef SUBARCH_i386
  40. EXPORT_SYMBOL(vsyscall_ehdr);
  41. EXPORT_SYMBOL(vsyscall_end);
  42. #endif
  43. EXPORT_SYMBOL_PROTO(__errno_location);
  44. EXPORT_SYMBOL_PROTO(access);
  45. EXPORT_SYMBOL_PROTO(open);
  46. EXPORT_SYMBOL_PROTO(open64);
  47. EXPORT_SYMBOL_PROTO(close);
  48. EXPORT_SYMBOL_PROTO(read);
  49. EXPORT_SYMBOL_PROTO(write);
  50. EXPORT_SYMBOL_PROTO(dup2);
  51. EXPORT_SYMBOL_PROTO(__xstat);
  52. EXPORT_SYMBOL_PROTO(__lxstat);
  53. EXPORT_SYMBOL_PROTO(__lxstat64);
  54. EXPORT_SYMBOL_PROTO(__fxstat64);
  55. EXPORT_SYMBOL_PROTO(lseek);
  56. EXPORT_SYMBOL_PROTO(lseek64);
  57. EXPORT_SYMBOL_PROTO(chown);
  58. EXPORT_SYMBOL_PROTO(fchown);
  59. EXPORT_SYMBOL_PROTO(truncate);
  60. EXPORT_SYMBOL_PROTO(ftruncate64);
  61. EXPORT_SYMBOL_PROTO(utime);
  62. EXPORT_SYMBOL_PROTO(utimes);
  63. EXPORT_SYMBOL_PROTO(futimes);
  64. EXPORT_SYMBOL_PROTO(chmod);
  65. EXPORT_SYMBOL_PROTO(fchmod);
  66. EXPORT_SYMBOL_PROTO(rename);
  67. EXPORT_SYMBOL_PROTO(__xmknod);
  68. EXPORT_SYMBOL_PROTO(symlink);
  69. EXPORT_SYMBOL_PROTO(link);
  70. EXPORT_SYMBOL_PROTO(unlink);
  71. EXPORT_SYMBOL_PROTO(readlink);
  72. EXPORT_SYMBOL_PROTO(mkdir);
  73. EXPORT_SYMBOL_PROTO(rmdir);
  74. EXPORT_SYMBOL_PROTO(opendir);
  75. EXPORT_SYMBOL_PROTO(readdir);
  76. EXPORT_SYMBOL_PROTO(closedir);
  77. EXPORT_SYMBOL_PROTO(seekdir);
  78. EXPORT_SYMBOL_PROTO(telldir);
  79. EXPORT_SYMBOL_PROTO(ioctl);
  80. EXPORT_SYMBOL_PROTO(pread64);
  81. EXPORT_SYMBOL_PROTO(pwrite64);
  82. EXPORT_SYMBOL_PROTO(statfs);
  83. EXPORT_SYMBOL_PROTO(statfs64);
  84. EXPORT_SYMBOL_PROTO(getuid);
  85. EXPORT_SYMBOL_PROTO(fsync);
  86. EXPORT_SYMBOL_PROTO(fdatasync);
  87. EXPORT_SYMBOL_PROTO(lstat64);
  88. EXPORT_SYMBOL_PROTO(fstat64);
  89. EXPORT_SYMBOL_PROTO(mknod);
  90. /* Export symbols used by GCC for the stack protector. */
  91. extern void __stack_smash_handler(void *) __attribute__((weak));
  92. EXPORT_SYMBOL(__stack_smash_handler);
  93. extern long __guard __attribute__((weak));
  94. EXPORT_SYMBOL(__guard);