19b11eb9a8
- Removed TactilityC, moved its symbols to existing modules and several new ones (pthread-module, c-symbols-module, cpp-symbols-module, posix-symbols-module, freertos-module). - Removed Firmware subproject and moved main() into Tactility subproject. - Strengthened application archive, path, version, stack-size, and device validation. - Moved symbol resolution for elf_loader to app-esp32-module. - Improved `struct Module` declarations and made module and symbol definitions in modules more consistent. - Removed old http download code from Tactility subproject. - Rename app-module's source files for consistency. - Add missing pthread symbols. - Kernel module symbols are now resolvable on all platforms.
89 lines
2.4 KiB
C++
89 lines
2.4 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <posix_symbols/module.h>
|
|
|
|
#include <csetjmp>
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <ctime>
|
|
#include <dirent.h>
|
|
#include <fcntl.h>
|
|
#include <strings.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
#if __has_include(<getopt.h>)
|
|
#include <getopt.h>
|
|
#define POSIX_SYMBOLS_HAS_GETOPT_LONG 1
|
|
#endif
|
|
|
|
extern "C" {
|
|
|
|
static const ModuleSymbol SYMBOLS[] = {
|
|
// unistd.h
|
|
DEFINE_MODULE_SYMBOL(usleep),
|
|
DEFINE_MODULE_SYMBOL(sleep),
|
|
DEFINE_MODULE_SYMBOL(exit),
|
|
DEFINE_MODULE_SYMBOL(close),
|
|
DEFINE_MODULE_SYMBOL(rmdir),
|
|
DEFINE_MODULE_SYMBOL(unlink),
|
|
DEFINE_MODULE_SYMBOL(open),
|
|
DEFINE_MODULE_SYMBOL(access),
|
|
DEFINE_MODULE_SYMBOL(isatty),
|
|
DEFINE_MODULE_SYMBOL(read),
|
|
DEFINE_MODULE_SYMBOL(write),
|
|
DEFINE_MODULE_SYMBOL(lseek),
|
|
// strings.h
|
|
#if defined(__BSD_VISIBLE) && __BSD_VISIBLE
|
|
DEFINE_MODULE_SYMBOL(explicit_bzero),
|
|
#endif
|
|
DEFINE_MODULE_SYMBOL(strcasecmp),
|
|
DEFINE_MODULE_SYMBOL(strncasecmp),
|
|
// string.h
|
|
DEFINE_MODULE_SYMBOL(strdup),
|
|
DEFINE_MODULE_SYMBOL(stpcpy),
|
|
// time.h
|
|
DEFINE_MODULE_SYMBOL(clock_gettime),
|
|
DEFINE_MODULE_SYMBOL(localtime_r),
|
|
// setjmp.h
|
|
DEFINE_MODULE_SYMBOL(longjmp),
|
|
DEFINE_MODULE_SYMBOL(setjmp),
|
|
// dirent.h
|
|
DEFINE_MODULE_SYMBOL(opendir),
|
|
DEFINE_MODULE_SYMBOL(closedir),
|
|
DEFINE_MODULE_SYMBOL(readdir),
|
|
// fcntl.h
|
|
DEFINE_MODULE_SYMBOL(fcntl),
|
|
// sys/stat.h
|
|
DEFINE_MODULE_SYMBOL(stat),
|
|
DEFINE_MODULE_SYMBOL(mkdir),
|
|
// stdlib.h
|
|
DEFINE_MODULE_SYMBOL(rand_r),
|
|
DEFINE_MODULE_SYMBOL(setenv),
|
|
DEFINE_MODULE_SYMBOL(unsetenv),
|
|
// stdio.h - lets an app find the descriptor behind a stream. Needed when stdin/stdout have
|
|
// been pointed somewhere other than descriptors 0 and 1, e.g. an app that owns a terminal.
|
|
DEFINE_MODULE_SYMBOL(fileno),
|
|
// getopt.h - optind/opterr/optarg/optopt are POSIX; getopt_long is a GNU/BSD extension, only
|
|
// exported when <getopt.h> is actually available.
|
|
DEFINE_MODULE_SYMBOL(optind),
|
|
DEFINE_MODULE_SYMBOL(opterr),
|
|
DEFINE_MODULE_SYMBOL(optarg),
|
|
DEFINE_MODULE_SYMBOL(optopt),
|
|
#ifdef POSIX_SYMBOLS_HAS_GETOPT_LONG
|
|
DEFINE_MODULE_SYMBOL(getopt_long),
|
|
#endif
|
|
MODULE_SYMBOL_TERMINATOR,
|
|
};
|
|
|
|
Module posix_symbols_module = {
|
|
.name = "posix-symbols",
|
|
.start = nullptr,
|
|
.stop = nullptr,
|
|
.drivers = nullptr,
|
|
.symbols = SYMBOLS,
|
|
.internal = nullptr,
|
|
};
|
|
|
|
}
|