user_syms.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #undef strlen
  9. #undef strstr
  10. #undef memcpy
  11. #undef memset
  12. extern size_t strlen(const char *);
  13. extern void *memcpy(void *, const void *, size_t);
  14. extern void *memmove(void *, const void *, size_t);
  15. extern void *memset(void *, int, size_t);
  16. extern int printf(const char *, ...);
  17. EXPORT_SYMBOL(strlen);
  18. EXPORT_SYMBOL(memcpy);
  19. EXPORT_SYMBOL(memmove);
  20. EXPORT_SYMBOL(memset);
  21. EXPORT_SYMBOL(printf);
  22. EXPORT_SYMBOL(strstr);
  23. /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
  24. * However, the modules will use the CRC defined *here*, no matter if it is
  25. * good; so the versions of these symbols will always match
  26. */
  27. #define EXPORT_SYMBOL_PROTO(sym) \
  28. int sym(void); \
  29. EXPORT_SYMBOL(sym);
  30. #ifdef SUBARCH_i386
  31. EXPORT_SYMBOL(vsyscall_ehdr);
  32. EXPORT_SYMBOL(vsyscall_end);
  33. #endif
  34. EXPORT_SYMBOL_PROTO(__errno_location);
  35. EXPORT_SYMBOL_PROTO(access);
  36. EXPORT_SYMBOL_PROTO(open);
  37. EXPORT_SYMBOL_PROTO(open64);
  38. EXPORT_SYMBOL_PROTO(close);
  39. EXPORT_SYMBOL_PROTO(read);
  40. EXPORT_SYMBOL_PROTO(write);
  41. EXPORT_SYMBOL_PROTO(dup2);
  42. EXPORT_SYMBOL_PROTO(__xstat);
  43. EXPORT_SYMBOL_PROTO(__lxstat);
  44. EXPORT_SYMBOL_PROTO(__lxstat64);
  45. EXPORT_SYMBOL_PROTO(lseek);
  46. EXPORT_SYMBOL_PROTO(lseek64);
  47. EXPORT_SYMBOL_PROTO(chown);
  48. EXPORT_SYMBOL_PROTO(truncate);
  49. EXPORT_SYMBOL_PROTO(utime);
  50. EXPORT_SYMBOL_PROTO(chmod);
  51. EXPORT_SYMBOL_PROTO(rename);
  52. EXPORT_SYMBOL_PROTO(__xmknod);
  53. EXPORT_SYMBOL_PROTO(symlink);
  54. EXPORT_SYMBOL_PROTO(link);
  55. EXPORT_SYMBOL_PROTO(unlink);
  56. EXPORT_SYMBOL_PROTO(readlink);
  57. EXPORT_SYMBOL_PROTO(mkdir);
  58. EXPORT_SYMBOL_PROTO(rmdir);
  59. EXPORT_SYMBOL_PROTO(opendir);
  60. EXPORT_SYMBOL_PROTO(readdir);
  61. EXPORT_SYMBOL_PROTO(closedir);
  62. EXPORT_SYMBOL_PROTO(seekdir);
  63. EXPORT_SYMBOL_PROTO(telldir);
  64. EXPORT_SYMBOL_PROTO(ioctl);
  65. EXPORT_SYMBOL_PROTO(pread64);
  66. EXPORT_SYMBOL_PROTO(pwrite64);
  67. EXPORT_SYMBOL_PROTO(statfs);
  68. EXPORT_SYMBOL_PROTO(statfs64);
  69. EXPORT_SYMBOL_PROTO(getuid);
  70. EXPORT_SYMBOL_PROTO(fsync);
  71. EXPORT_SYMBOL_PROTO(fdatasync);
  72. /*
  73. * Overrides for Emacs so that we follow Linus's tabbing style.
  74. * Emacs will notice this stuff at the end of the file and automatically
  75. * adjust the settings for this buffer only. This must remain at the end
  76. * of the file.
  77. * ---------------------------------------------------------------------------
  78. * Local variables:
  79. * c-file-style: "linux"
  80. * End:
  81. */