1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 237185b33SAl Viro #include <linux/types.h> 337185b33SAl Viro #include <linux/module.h> 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds /* Some of this are builtin function (some are not but could in the future), 61da177e4SLinus Torvalds * so I *must* declare good prototypes for them and then EXPORT them. 71da177e4SLinus Torvalds * The kernel code uses the macro defined by include/linux/string.h, 81da177e4SLinus Torvalds * so I undef macros; the userspace code does not include that and I 9e8234483SJeff Dike * add an EXPORT for the glibc one. 10e8234483SJeff Dike */ 111da177e4SLinus Torvalds 121da177e4SLinus Torvalds #undef strlen 131da177e4SLinus Torvalds #undef strstr 141da177e4SLinus Torvalds #undef memcpy 151da177e4SLinus Torvalds #undef memset 161da177e4SLinus Torvalds 171da177e4SLinus Torvalds extern size_t strlen(const char *); 181da177e4SLinus Torvalds extern void *memmove(void *, const void *, size_t); 191da177e4SLinus Torvalds extern void *memset(void *, int, size_t); 201da177e4SLinus Torvalds extern int printf(const char *, ...); 211da177e4SLinus Torvalds 221a65f493SJeff Dike /* If it's not defined, the export is included in lib/string.c.*/ 237c45ad16SPaolo 'Blaisorblade' Giarrusso #ifdef __HAVE_ARCH_STRSTR 247c45ad16SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(strstr); 257c45ad16SPaolo 'Blaisorblade' Giarrusso #endif 267c45ad16SPaolo 'Blaisorblade' Giarrusso 2700699e84Sakpm@linux-foundation.org #ifndef __x86_64__ 2800699e84Sakpm@linux-foundation.org extern void *memcpy(void *, const void *, size_t); 291da177e4SLinus Torvalds EXPORT_SYMBOL(memcpy); 301da177e4SLinus Torvalds EXPORT_SYMBOL(memmove); 311da177e4SLinus Torvalds EXPORT_SYMBOL(memset); 32*5b301409SPatricia Alfonso #endif 33*5b301409SPatricia Alfonso 341da177e4SLinus Torvalds EXPORT_SYMBOL(printf); 351da177e4SLinus Torvalds 361da177e4SLinus Torvalds /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. 371da177e4SLinus Torvalds * However, the modules will use the CRC defined *here*, no matter if it is 381da177e4SLinus Torvalds * good; so the versions of these symbols will always match 391da177e4SLinus Torvalds */ 401da177e4SLinus Torvalds #define EXPORT_SYMBOL_PROTO(sym) \ 411da177e4SLinus Torvalds int sym(void); \ 421da177e4SLinus Torvalds EXPORT_SYMBOL(sym); 431da177e4SLinus Torvalds 4474433c0fSPaolo 'Blaisorblade' Giarrusso extern void readdir64(void) __attribute__((weak)); 4574433c0fSPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(readdir64); 4674433c0fSPaolo 'Blaisorblade' Giarrusso extern void truncate64(void) __attribute__((weak)); 4774433c0fSPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(truncate64); 4874433c0fSPaolo 'Blaisorblade' Giarrusso 49c6b17bbdSAl Viro #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA 501da177e4SLinus Torvalds EXPORT_SYMBOL(vsyscall_ehdr); 511da177e4SLinus Torvalds EXPORT_SYMBOL(vsyscall_end); 521da177e4SLinus Torvalds #endif 531da177e4SLinus Torvalds 541da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__errno_location); 551da177e4SLinus Torvalds 561da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(access); 571da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(open); 581da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(open64); 591da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(close); 601da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(read); 611da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(write); 621da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(dup2); 631da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__xstat); 641da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__lxstat); 651da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__lxstat64); 66e8234483SJeff Dike EXPORT_SYMBOL_PROTO(__fxstat64); 671da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(lseek); 681da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(lseek64); 691da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(chown); 70e8234483SJeff Dike EXPORT_SYMBOL_PROTO(fchown); 711da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(truncate); 72e8234483SJeff Dike EXPORT_SYMBOL_PROTO(ftruncate64); 731da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(utime); 74e8234483SJeff Dike EXPORT_SYMBOL_PROTO(utimes); 75e8234483SJeff Dike EXPORT_SYMBOL_PROTO(futimes); 761da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(chmod); 77e8234483SJeff Dike EXPORT_SYMBOL_PROTO(fchmod); 781da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(rename); 791da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__xmknod); 801da177e4SLinus Torvalds 811da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(symlink); 821da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(link); 831da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(unlink); 841da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(readlink); 851da177e4SLinus Torvalds 861da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(mkdir); 871da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(rmdir); 881da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(opendir); 891da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(readdir); 901da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(closedir); 911da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(seekdir); 921da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(telldir); 931da177e4SLinus Torvalds 941da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(ioctl); 951da177e4SLinus Torvalds 961da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(pread64); 971da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(pwrite64); 981da177e4SLinus Torvalds 991da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(statfs); 1001da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(statfs64); 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(getuid); 1031da177e4SLinus Torvalds 104a2d76bd8SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL_PROTO(fsync); 105a2d76bd8SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL_PROTO(fdatasync); 106a2d76bd8SPaolo 'Blaisorblade' Giarrusso 107005a59ecSAl Viro EXPORT_SYMBOL_PROTO(lstat64); 108005a59ecSAl Viro EXPORT_SYMBOL_PROTO(fstat64); 109005a59ecSAl Viro EXPORT_SYMBOL_PROTO(mknod); 110005a59ecSAl Viro 111cead61a6SPaolo 'Blaisorblade' Giarrusso /* Export symbols used by GCC for the stack protector. */ 112cead61a6SPaolo 'Blaisorblade' Giarrusso extern void __stack_smash_handler(void *) __attribute__((weak)); 113cead61a6SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(__stack_smash_handler); 114cead61a6SPaolo 'Blaisorblade' Giarrusso 115cead61a6SPaolo 'Blaisorblade' Giarrusso extern long __guard __attribute__((weak)); 116cead61a6SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(__guard); 117f956b3e4SRichard Weinberger 118f956b3e4SRichard Weinberger #ifdef _FORTIFY_SOURCE 119f956b3e4SRichard Weinberger extern int __sprintf_chk(char *str, int flag, size_t strlen, const char *format); 120f956b3e4SRichard Weinberger EXPORT_SYMBOL(__sprintf_chk); 121f956b3e4SRichard Weinberger #endif 122