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