Commit Graph

1640 Commits

Author SHA1 Message Date
liqinhui 602c644f4d netdb: When set a dns nameserver, if the nameserver already exists, retrun OK.
We consider the setting successful when the namesaerver we set already exists.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-10-12 12:22:16 +08:00
hujun5 99eeaafd07 lib_memfd: turn a runtime error into a linker error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-11 23:39:37 +08:00
Lee Lup Yuen 6cad7e9582 arm, arm64, xtensa, libxx: Change sed -r to sed -E to support macOS
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
2023-10-10 11:36:32 +03:00
raiden00pl 4f8a2b3874 libds/lib_misc: use b16abs() 2023-10-07 21:25:56 +08:00
raiden00pl 819bec0888 libdsp/lib_observe: fix typo and use b16sign() 2023-10-07 21:25:56 +08:00
Xiang Xiao dfa0283d83 spinlock: Rename spin_islocked to spin_is_locked
align with Linux naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-06 20:03:19 -04:00
Xiang Xiao aa0b3fcdf9 lib/memfd: shm_unlink or unlink anonymous file
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>
2023-10-06 20:02:30 -04:00
SPRESENSE bf6606f80c libxx: Use gnu++20 option only if using libcxx
Fix an issue that gnu++20 option is always used.
Essentially, when cxx is not used, gnu++17 should be retained.
2023-10-05 13:09:20 +08:00
hujun5 b6693065e7 pthread_once: g_lock may lead deadlock
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>
2023-09-26 10:13:00 +08:00
Xiang Xiao b172de378d Fix make[1]: *** No rule to make target '.header', needed by 'context'. Stop.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-25 23:29:05 +08:00
Xiang Xiao 06619ac6fc lib/netdb: Change the default NETDB_DNSCLIENT_NAMESIZE to PATH_MAX
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>
2023-09-24 19:32:25 -04:00
Xiang Xiao b383c31089 libc: Add bsearch to libc.csv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-25 01:08:15 +03:00
Xiang Xiao 381c7dd747 Fix error: unknown warning option '-Wno-unqualified-std-cast-call'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
Stuart Ianna 4f90a6140c libcxx: Remove exiting patches and update libcxx version to 15.0.7
- 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
2023-09-24 08:40:10 +03:00
Xiang Xiao d6453cfc3c libxx: Change the default value of CXX_STANDARD to gnu++20
since llvm libcxx 15.0.7 require c++20 feature to pass the build

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
zhanghongyu a41f68da84 dns: fix dns failed when ipv4/6 dual stack enable
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>
2023-09-23 15:56:05 +08:00
wangyongrong 2d817deecb armv8m/strcpy: add arch optimize version 2023-09-22 08:52:25 +08:00
guoshichao abfb7da553 libs/libc/libc.csv: add the implemented wchar api declaration
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 5bd8e56cbe libs/libc/wchar: add fputws implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao d67090c47e libs/libc/wchar: add putwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao a9b2857754 libs/libc/wchar: add putwchar implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao f8b5f613e2 libs/libc/wchar: add fputwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao d386df4424 libs/libc/wchar: add wcswidth implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 7c0685c53d libs/libc/wchar: add wcwidth implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao f9c8461c72 libs/libc/wchar: add wcswcs implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 199bc57035 libs/libc/wchar: add wcstok implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 9070743fe8 libs/libc/wchar: add wcsstr implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 20802fcf5c libs/libc/wchar: add wcsspn implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 181a2d916d libs/libc/wchar: add wcspbrk implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 2abb760564 libs/libc/wchar/CMakeList: update the cmake to add the wchar impl
add lib_wcsrtombs.c lib_wcscpy.c lib_wcscat.c lib_wcslcat.c
lib_wcsncat.c lib_wcsrchr.c lib_wcschr.c lib_wcsncpy.c
lib_wcsncmp.c lib_wcscspn.c file

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao e2962e84c5 libs/libc/wchar: add wcsspn implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao 899f170826 libs/libc/wchar: add wcsncmp implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao ae4303da2f libs/libc/wchar: add wcsncpy implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao 34346e38e1 libs/libc/wchar: add the wcschr implementatioin
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao 206cd96426 libs/libc/wchar: add wcsrchr implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao cd19acee76 libs/libc/wchar: add wcsncat implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao 4f9d304591 libs/libc/wchar: add wcslcat implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao 0a1708dbb2 libs/libc/wchar: add wcscat implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao 4b1c0220d3 libs/libc/wchar: add wcscpy implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
hujun5 4268b2e297 pthread_once: use rmutex replace sched_[un]lock
sched_[un]lock can not prohibit pre-emption in smp

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-09-21 00:42:29 +08:00
Neale Ferguson 5d7f2fdf16 Fix loading of ET_DYN type of shared objects
* 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
2023-09-20 09:35:28 -04:00
dongjiuzhu1 3884087396 libc/mod: fix minor issue about description
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
dongjiuzhu1 e8c9541263 libs/modlib: avoid double free when call modlib_unload with erro
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
dongjiuzhu1 310ba09ed7 libs/modlib: avoid seeking in each reading
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
dongjiuzhu1 13bdaaec99 libs/modlib: close fd when error happen
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
chao an 6b070b2b00 libs/libc: currect usage of getpid/gettid in library
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-20 10:08:24 +08:00
hujun5 51a412c6b4 pthread_cleanup: rm sched_[un]lock
Since TLS is only used within a single thread and requires no additional protection.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-09-20 00:44:19 +08:00
chenrun1 4ce205cf08 lib_iconv.c:Fix possible out-of-bounds reads
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-09-19 09:34:48 +08:00
Petro Karashchenko 587f01a5e2 libs/libxx/libcxx: fix CI compilation issue reported on MACOS
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-19 01:17:17 +08:00
chao an 5026a96cfa nxstyle: cleanup UTF-8 Unicode to ASCII
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-18 11:54:17 -04:00