This commit adds support for custom stream via fopencookie function.
The function allows the programmer the create his own custom stream
for IO operations and hook his custom functions to it.
This is a non POSIX interface defined in Standard C library and implemented
according to it. The only difference is in usage of off_t instead of
off64_t. Programmer can use 64 bits offset if CONFIG_FS_LARGEFILE is
enabled. In that case off_t is defined as int64_t (int32_t otherwise).
Field fs_fd is removed from file_struct and fs_cookie is used instead
as a shared variable for file descriptor or user defined cookie.
The interface will be useful for future fmemopen implementation.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
both functions aren't suitable to be put into libc,
because they call the kernel internal functions directly.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
When we build NuttX on macOS, it shows many `sed` messages (and the build still completes successfully):
```text
$ tools/configure.sh pinephone:nsh
$ make
sed: illegal option -- r
```
This is due to the Makefiles executing `sed -r` which is not a valid option on macOS.
This PR proposes to change `sed -r` to `sed -E` because:
- `sed -E` on macOS is equivalent to `sed -r` on Linux
- `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual
- `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake and process_config.sh
https://man7.org/linux/man-pages/man2/memfd_create.2.html:
The name supplied in name is used as a filename and will be
displayed as the target of the corresponding symbolic link in the
directory /proc/self/fd/. The displayed name is always prefixed
with memfd: and serves only for debugging purposes. Names do not
affect the behavior of the file descriptor, and as such multiple
files can have the same name without any side effects.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
For programs with the dependencies logic in pthread_once callback , using global locks may cause deadlock:
task A
pthread_once()
|
|-> nxrmutex_lock(&g_lock);
-> init_routine(); // callback to wait task B
task B
pthread_once()
|
->nxrmutex_lock(&g_lock); // Deadlock
->init_routine(); // hold resource to wake up task A
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Domain name has the similar layout as file path, so it's too small
to use 32 bytes as the default value, and better to has the same
default value as PATH_MAX which is 255.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
- Add __config_site for NuttX.
In libcxx 12.0.0. CMake concatenated __config_site with _config,
which enabled NuttX to build without its inclusion. In 15.0.7, this
file is configured by CMake and included explicitly in __config.
- Add additional include directories.
- Mute always_inline warning.
- Make the download of libcxx/libcxxabi configurable
The ipv6 address filled the cache, and the ipv4 address did not have a
place to store it, causing the resolution to fail. so if IPV6 has already
filled the buffer, rewrite ipv4 DNS results from half of the buffer.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
* build-globals.sh
- Only look in the nuttx for external symbols used when loading
dynamic shared objects
* include/elf64.h
- Correct the type of fields in the Elf64_Phdr structure
* libs/libc/dlfcn/lib_dlclose.c
- Distinguish between ET_DYN and other objects as the former
has both text and data in a single allocation to reserve
GOT offsets
* libs/libc/dlfcn/lib_dlopen.c
- Code formatting
* libs/libc/modlib/modlib_bind.c
- Distinguish between relocation entry sizes by section type
- Handle RELA style relocations
* libs/libc/modlib/modlib_globals.S
- Formatting fixes
- Symbols should not be weak - they exist or they don't
* include/nuttx/lib/modlib.h
- Add an inidcator to module_s to distinguish between ET_DYN and other
* libs/libc/modlib/modlib_load.c
- ET_DYN objects need to keep the relative displacement between the text
and data sections due to GOT references from the former to the latter.
This also implies that linking may require modification from the default
for the shared objects being produced. For example, default alignment may
mean nearly 64K of wasted space.
* libs/libc/modlib/modlib_unload.c
sched/module/mod_rmmod.c
- Distingusih between freeing of ET_DYN storage and other as the former
is a single allocation.
* libs/libc/modlib/mod_insmod.c
- Cater for ET_DYN objects having init and preinit sections