Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/types.h>
0003 #include <linux/module.h>
0004 
0005 /* Some of this are builtin function (some are not but could in the future),
0006  * so I *must* declare good prototypes for them and then EXPORT them.
0007  * The kernel code uses the macro defined by include/linux/string.h,
0008  * so I undef macros; the userspace code does not include that and I
0009  * add an EXPORT for the glibc one.
0010  */
0011 
0012 #undef strlen
0013 #undef strstr
0014 #undef memcpy
0015 #undef memset
0016 
0017 extern size_t strlen(const char *);
0018 extern void *memmove(void *, const void *, size_t);
0019 extern void *memset(void *, int, size_t);
0020 extern int printf(const char *, ...);
0021 
0022 /* If it's not defined, the export is included in lib/string.c.*/
0023 #ifdef __HAVE_ARCH_STRSTR
0024 EXPORT_SYMBOL(strstr);
0025 #endif
0026 
0027 #ifndef __x86_64__
0028 extern void *memcpy(void *, const void *, size_t);
0029 EXPORT_SYMBOL(memcpy);
0030 EXPORT_SYMBOL(memmove);
0031 EXPORT_SYMBOL(memset);
0032 #endif
0033 
0034 EXPORT_SYMBOL(printf);
0035 
0036 /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
0037  * However, the modules will use the CRC defined *here*, no matter if it is
0038  * good; so the versions of these symbols will always match
0039  */
0040 #define EXPORT_SYMBOL_PROTO(sym)       \
0041     int sym(void);                  \
0042     EXPORT_SYMBOL(sym);
0043 
0044 extern void readdir64(void) __attribute__((weak));
0045 EXPORT_SYMBOL(readdir64);
0046 extern void truncate64(void) __attribute__((weak));
0047 EXPORT_SYMBOL(truncate64);
0048 
0049 #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
0050 EXPORT_SYMBOL(vsyscall_ehdr);
0051 EXPORT_SYMBOL(vsyscall_end);
0052 #endif
0053 
0054 EXPORT_SYMBOL_PROTO(__errno_location);
0055 
0056 EXPORT_SYMBOL_PROTO(access);
0057 EXPORT_SYMBOL_PROTO(open);
0058 EXPORT_SYMBOL_PROTO(open64);
0059 EXPORT_SYMBOL_PROTO(close);
0060 EXPORT_SYMBOL_PROTO(read);
0061 EXPORT_SYMBOL_PROTO(write);
0062 EXPORT_SYMBOL_PROTO(dup2);
0063 EXPORT_SYMBOL_PROTO(__xstat);
0064 EXPORT_SYMBOL_PROTO(__lxstat);
0065 EXPORT_SYMBOL_PROTO(__lxstat64);
0066 EXPORT_SYMBOL_PROTO(__fxstat64);
0067 EXPORT_SYMBOL_PROTO(lseek);
0068 EXPORT_SYMBOL_PROTO(lseek64);
0069 EXPORT_SYMBOL_PROTO(chown);
0070 EXPORT_SYMBOL_PROTO(fchown);
0071 EXPORT_SYMBOL_PROTO(truncate);
0072 EXPORT_SYMBOL_PROTO(ftruncate64);
0073 EXPORT_SYMBOL_PROTO(utime);
0074 EXPORT_SYMBOL_PROTO(utimes);
0075 EXPORT_SYMBOL_PROTO(futimes);
0076 EXPORT_SYMBOL_PROTO(chmod);
0077 EXPORT_SYMBOL_PROTO(fchmod);
0078 EXPORT_SYMBOL_PROTO(rename);
0079 EXPORT_SYMBOL_PROTO(__xmknod);
0080 
0081 EXPORT_SYMBOL_PROTO(symlink);
0082 EXPORT_SYMBOL_PROTO(link);
0083 EXPORT_SYMBOL_PROTO(unlink);
0084 EXPORT_SYMBOL_PROTO(readlink);
0085 
0086 EXPORT_SYMBOL_PROTO(mkdir);
0087 EXPORT_SYMBOL_PROTO(rmdir);
0088 EXPORT_SYMBOL_PROTO(opendir);
0089 EXPORT_SYMBOL_PROTO(readdir);
0090 EXPORT_SYMBOL_PROTO(closedir);
0091 EXPORT_SYMBOL_PROTO(seekdir);
0092 EXPORT_SYMBOL_PROTO(telldir);
0093 
0094 EXPORT_SYMBOL_PROTO(ioctl);
0095 
0096 EXPORT_SYMBOL_PROTO(pread64);
0097 EXPORT_SYMBOL_PROTO(pwrite64);
0098 
0099 EXPORT_SYMBOL_PROTO(statfs);
0100 EXPORT_SYMBOL_PROTO(statfs64);
0101 
0102 EXPORT_SYMBOL_PROTO(getuid);
0103 
0104 EXPORT_SYMBOL_PROTO(fsync);
0105 EXPORT_SYMBOL_PROTO(fdatasync);
0106 
0107 EXPORT_SYMBOL_PROTO(lstat64);
0108 EXPORT_SYMBOL_PROTO(fstat64);
0109 EXPORT_SYMBOL_PROTO(mknod);
0110 
0111 /* Export symbols used by GCC for the stack protector. */
0112 extern void __stack_smash_handler(void *) __attribute__((weak));
0113 EXPORT_SYMBOL(__stack_smash_handler);
0114 
0115 extern long __guard __attribute__((weak));
0116 EXPORT_SYMBOL(__guard);
0117 
0118 #ifdef _FORTIFY_SOURCE
0119 extern int __sprintf_chk(char *str, int flag, size_t strlen, const char *format);
0120 EXPORT_SYMBOL(__sprintf_chk);
0121 #endif