Add a minimal implementation to suppress warnings when building
application code shared with other operating systems.
For example:
When building with a c++ compiler and GCC 12.2.0, the following warning is emitted:
nuttx/include/spawn.h:178:40: warning: statement has no effect [-Wunused-value]
178 | #define posix_spawnattr_destroy(attr) (0)
Add support for POSIX interface fmemopen(). This interface open a memory
buffer as a stream and permits access to this buffer specified by mode.
This allows I/O operations to be performed on the memory buffer.
The implementation uses fopencookie() for custom stream operations and
callbacks.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
CPP: nuttx-names.in-> nuttx-names.dat
LD: nuttx
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: nuttx.rel:/d/a/nuttx_windows/nuttx_windows/nuttxspace/nuttx/libs/libc/stdlib/lib_exit.c:48: multiple definition of `__dso_handle'; /usr/lib/gcc/x86_64-pc-msys/13.2.0/crtbegin.o:cygming-crtbeg:(.data+0x0): first defined here
Silence two warnings when building libcxx with GCC 12.2.0 and std=c++2b:
libcxx/src/charconv.cpp_CXXFLAGS += -Wno-attributes
- Results from libcxx fallback to use __always_inline__ when exclude_from_explicit_instantiation isn't available.
libcxx/src/locale.cpp_CXXFLAGS += -Wno-attributes
- Results from the expansion of _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS. Should be fine to ignore.
CC: icmp/icmp_input.c modlib/modlib_load.c: In function 'modlib_elfsize':
modlib/modlib_load.c:87:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
87 | textaddr = (FAR void *)phdr->p_vaddr;
| ^
cc1: all warnings being treated as errors
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
modlib/modlib_symbols.c: In function ‘modlib_symcallback’:
modlib/modlib_symbols.c:215:13: warning: implicit declaration of function ‘modlib_depend’; did you mean ‘modlib_read’? [-Wimplicit-function-declaration]
215 | ret = modlib_depend(exportinfo->modp, modp);
| ^~~~~~~~~~~~~
| modlib_read
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
CP: nuttx/include/nuttx/config.h
modlib/modlib_init.c:53: warning: "modlib_dumpbuffer" redefined
53 | # define modlib_dumpbuffer(m,b,n) binfodumpbuffer(m,b,n)
|
In file included from modlib/modlib_init.c:36:
nuttx/include/nuttx/lib/modlib.h:64: note: this is the location of the previous definition
64 | # define modlib_dumpbuffer(m,b,n) sinfodumpbuffer(m,b,n)
|
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
__dtoa is not used because currently NuttX uses other
function called __dtoa_engine() to do the same thing
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
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>