Linux Audio

Check our new training course

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