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
yanghuatao
7ea52505c2
libm/libmcs: Fix clang build download libmcs warning
...
VELAPLATFO-16865
Fix warnings:
CC: libmcs/libmcs/libm/common/fenv.c libmcs/libmcs/libm/common/fenv.c:26:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int fegetround()
^
void
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-09-18 23:00:38 +08:00
yanghuatao
88193d3ad5
libm/libmcs: Fix clang build libmcs warning
...
VELAPLATFO-15795
Fix warnings:
1 warning generated.
CC: libmcs/libmcs/libm/mathd/lrintd.c libmcs/libmcs/libm/mathd/lrintd.c:141:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
return __MIN_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
#define __MIN_LONG 0x8000000000000000L
^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathd/lrintd.c:144:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
return __MAX_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
#define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC: libmcs/libmcs/libm/mathd/lroundd.c libmcs/libmcs/libm/mathd/lroundd.c:123:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
return __MIN_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
#define __MIN_LONG 0x8000000000000000L
^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathd/lroundd.c:126:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
return __MAX_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
#define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC: libmcs/libmcs/libm/mathf/lrintf.c libmcs/libmcs/libm/mathf/lrintf.c:67:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
return __MIN_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
#define __MIN_LONG 0x8000000000000000L
^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathf/lrintf.c:70:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
return __MAX_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
#define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC: libmcs/libmcs/libm/mathf/lroundf.c libmcs/libmcs/libm/mathf/lroundf.c:32:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
return __MIN_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
#define __MIN_LONG 0x8000000000000000L
^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathf/lroundf.c:34:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
return __MAX_LONG;
~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
#define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-09-18 21:02:39 +08:00
dongjiuzhu1
4763ca849a
libxx/libcxx: select PTHREAD_MUTEX_TYPES to support recursive mutex
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-18 15:34:44 +08:00
Daniel Appiagyei
5bfda12634
c++ compatibility: rename reserved c++ keywords 'public' and 'this'
2023-09-16 19:45:02 +08:00
SPRESENSE
3c96621e1e
libs:netdb: Restrict DNS query types
...
Corresponds to the problem of name resolution with different IP
address types in networks where only one of IPv4 or IPv6 can be
used due to physical layer reasons (e.g., LTE networks).
2023-09-16 14:43:12 +08:00
Petro Karashchenko
8a72eaf557
libs/libc/modlib: fix nxstyle issues
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
Petro Karashchenko
440be65010
spinlock: use spinlock API instead of direct asignment/compare
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
Petro Karashchenko
f06c509f9e
libs/libc/pthread: correct description on pthread_setcanceltype
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
Xiang Xiao
368198706a
lib/machine: Add LIBC_PREVENT_xxx which select LIBC_PREVENT_XXX_[KERNEL|USER] automatically
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-15 22:31:34 +03:00
yangdongdong
fa620dee9d
Provide flat mode the chip string customization.
...
Signed-off-by: yangdongdong <yangdongdong@xiaomi.com>
2023-09-15 13:34:55 +08:00
Roy Feng
e90d58c3da
esp32: Use newlib-esp32
...
When we are using newlib as libm, we can consider newlib-esp32 for esp32
hardware. An it contains some optimization for esp32 hardware.
Besides, two small issues has been fixed.
1. add the tar ball to .gitignore
2. Fix the some build warnings
2023-09-14 19:33:50 +08:00
Ville Juven
c178fa3260
stdio/lib_libfread: Fix buffer overflow issue
...
If the gulp size in the stdio buffer the remaining user buffer size it will:
- Corrupt memory in dest (user memory) and
- Keep corrupting KERNEL memory via the stdio character buffer until the
whole system crashes, as the 'remaining' count underflows
This patch fixes this behavior.
2023-09-13 21:52:57 +08:00
chao an
9f10ddc9b0
nuttx/build: Restore ARLOCK to improve compile speed in incremental case
...
To solve the issue of carrying object files from previous builds,
Matias changed the archiving process to re-archive libapps.a on every compilation,
if libapps.a carries more object files, incremental compilation will waste too
many time in re-archiving, compared with the previous implement, this is a degradation
of the build system. Referring to mature engineering projects such as cmake, if there
is configuration or source file changed, the best solution should be to reconfigure
the environment.
Revert this PR to ensure the compilation speed during incremental compilation.
| commit 34b34e2d45
(tag: nuttx-20200914-172150)
| Author: Matias N <matias@protobits.dev>
| Date: Fri Sep 11 22:31:38 2020 -0300
|
| Fix: ensure archive files do not carry object files from prior builds
|
| In some cases, when NuttX configuration changes and this makes the
| object list used to build one of the .a libraries change as well,
| since the command used to build it is "ar crs" and this simply appends
| the list of object files, the library could still include object
| files from prior builds. This commit modifies the ARCHIVE macro to
| erase the .a file if it already exists.
|
| Since in some cases this behavior was actually expected (object
| files from a subdirectory were appended to a library created one
| level above) I added a ARCHIVE_ADD which works as ARCHIVE did.
|
| This change should greatly improve behavior of building after
| configuration changes.
Testing:
sim:nsh
-------------------------------
| Patched | Current
-------------------------------
|$ time make | $ time make
|real 0m1.270s | real 0m1.728s
|user 0m0.971s | user 0m1.276s
|sys 0m0.363s | sys 0m0.530s
-------------------------------
Private project (20+ 3rd library needs archive to libapps.a)
-------------------------------
| Patched | Current
-------------------------------
|$ time make | $ time make
|real 0m21.181s | real 0m39.721s
|user 0m14.638s | user 0m24.837s
|sys 0m6.919s | sys 0m14.394s
-------------------------------
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-12 21:55:23 +08:00
wangming9
61a38ca680
libs/libxx/libcxx: Fix compilation warnings
...
Summary
Workaround the following warning with "GCC 12"
CXX: libcxxabi/src/cxa_demangle.cpp In file included from libcxx/src/locale.cpp:15:
In member function 'std::__1::_EnableIf<std::__1::__is_cpp17_forward_iterator<_ForwardIterator>::value> std::__1::basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = const wchar_t*; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]', inlined from 'std::__1::basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator, _InputIterator) [with _InputIterator = const wchar_t*; <template-parameter-2-2> = void; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]' at include/libcxx/string:2182:11,
inlined from 'virtual int std::__1::collate_byname<wchar_t>::do_compare(const char_type*, const char_type*, const char_type*, const char_type*) const' at libcxx/src/locale.cpp:764:33:
include/libcxx/string:2156:35: warning: 'lhs' may be used uninitialized [-Wmaybe-uninitialized]
2156 | this->__throw_length_error();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
include/libcxx/new:237:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
237 | return ::operator new(__args...);
| ~~~~~~~~~~~~~~^~~~~~~~~~~
Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-09 17:08:23 +03:00
wangming9
6265596cd0
libs/libc: Modify the Kconfig error description
...
Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-09 17:08:23 +03:00
yangyalei
fd776e8cee
fix wait after vfork return error
...
vfork use waitpid hang father process,
but waitpid release child processs information by default.
So when user call wait, it return errno 10.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-09-08 00:53:56 +03:00
yangyalei
eba2f163ed
Revert "fix wait after vfork return error"
...
This reverts commit 50428979d0
.
2023-09-08 00:53:56 +03:00
dongjiuzhu1
ee598b3e21
libc/mallopt: implement dummy mallopt
...
refs:
https://man.freebsd.org/cgi/man.cgi?query=malloc&apropos=0&sektion=3&manpath=SunOS+4.1.3&format=html
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-07 23:11:10 +08:00
dongjiuzhu1
5e3c1985e7
libc/fopen: support fopen with mode 'm'
...
refs:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
This is a fake implementation, in order for fopen to succeed,
Because the complete mmap mapping the entire file will waste a lot of
memory.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-07 23:05:38 +08:00
shizhenghui
6d2ece0c25
libsrc: update version in CMakeLists.txt
...
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-09-07 22:15:48 +08:00
shizhenghui
036127128a
libsrc: support for multiple sinc converters
...
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-09-07 22:15:48 +08:00
shizhenghui
6e9cf9af15
libsrc: update version number
...
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-09-07 22:15:48 +08:00
shizhenghui
a9242c5d68
libsrc: fix build warning
...
CC: umm_heap/umm_brkaddr.c libsamplerate/src/samplerate.c: In function ‘src_float_to_int_array’:
libsamplerate/src/samplerate.c:468:5: warning: "CPU_CLIPS_POSITIVE" is not defined, evaluates to 0 [-Wundef]
468 | #if CPU_CLIPS_POSITIVE == 0
| ^~~~~~~~~~~~~~~~~~
libsamplerate/src/samplerate.c:474:5: warning: "CPU_CLIPS_NEGATIVE" is not defined, evaluates to 0 [-Wundef]
474 | #if CPU_CLIPS_NEGATIVE == 0
| ^~~~~~~~~~~~~~~~~~
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-09-07 22:15:48 +08:00
SPRESENSE
d4fbd7a190
libs/libc: Fix a fatal bug in fread
...
Fix a bug the destination buffer is not updated.
It is caused by the following commit.
commit 5d8d5bfd73
2023-09-07 17:44:31 +08:00
yinshengkai
7115b6adad
libm: ignore git submodules
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-07 11:27:00 +03:00
dongjiuzhu1
df98320c2c
libs/libc: support unlock version for fread/fwrite/fputc/fgetc/...
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-06 15:08:24 +03:00
dongjiuzhu1
e8842f59da
libs/libc: remove unnecessary flockfile to improve performance
...
modify lib_wrflush/lib_rdflush/lib_ffulsh to unlocked version
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-06 15:08:24 +03:00
yangyalei
616828bae4
pwd: fix syntax error
...
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-09-04 23:19:46 +08:00
Xiang Xiao
4c3232a229
libc/machine: Fix ARMV[7|8]M_STRING_FUNCTION typo error in Kconfig
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-30 12:28:41 +03:00
yangdongdong
1956385a7d
libs/libc: Breakdown LIBC_BUILD_STRING into specific string operations macro.
...
Provide a way to only customize specific string operations,
such as for memcpy with the DMA capability by ROM.
Signed-off-by: yangdongdong <yangdongdong@xiaomi.com>
2023-08-29 22:55:18 +08:00
chenxiaoyi
cc690f1d21
move task tls destruct to before _exit
...
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2023-08-29 12:05:57 +08:00
wangyingdong
0a567c3c29
change the default NETDB_DNSCLIENT_MAXRESPONSE to the standard length
...
the size of the dns response buffer
https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-respsize-12
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2023-08-29 09:44:37 +08:00
fangxinyong
946ede865d
signal: add siginterrupt implementation
...
https://pubs.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.html
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-29 09:43:42 +08:00
Xiang Xiao
47faeeb360
tls: Move task_tls_alloc and task_tls_destruct to libc
...
so task_tls_destruct can be called from usrspace, which is required by:
https://github.com/apache/nuttx/pull/10288
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-28 11:02:18 +03:00
Xiang Xiao
cb8df39207
binfmt/elf: Fix the minor style issue
...
and remove the unused macros and unnecessary cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-27 18:46:40 -03:00
Xin Xu
e152391022
Apply suggestions from code review
...
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-27 21:41:53 +08:00
xuxin19
27c0e12d25
cmake:support newlib cmake build
...
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-27 21:41:53 +08:00
liaoao
3da7775543
libfdt: modify makefile
...
update LIBFDT to LIBC_FDT
update CONFIG_LIBFDT_DTC_VERSION to CONFIG_LIBC_FDT_DTC_VERSION
move dtc source code to fdt/dtc
move version_gen.h from apps/system/fdt to current dir
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-08-26 17:07:02 +08:00
xuxin19
48d95b8d82
cmake:replace custom_patch_target with PATCH_COMMAND
...
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-24 17:46:43 +02:00
Stuart Ianna
5d8d5bfd73
libc/libfread: Use memcpy to copy read-ahead buffer to caller buffer.
...
This change improves the performance when using larger CONFIG_STDIO_BUFFER_SIZE values as it allows architecture specific, or optimized memcpy algorithms to be utilized.
Link: https://git.motec.com.au/id/I317dc4da266aed1ce0f1b5f9a609759e863b9005
2023-08-24 11:19:54 +08:00
chao an
ba2601deb6
Toolchain: strict GCC version check from GCC-12.2 to GCC-12
...
Toolchain related detection errors are still not resolved on GCC-12.3
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-23 23:52:17 +08:00
Xiang Xiao
fdf7055d7b
libc: Guard gettext function with CONFIG_LIBC_LOCALE_GETTEXT in libc.csv
...
since Makefile and source files doesn't use CONFIG_LIBC_LOCALE at all
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-22 17:27:41 +08:00
dongjiuzhu1
33446608b5
libc/gpsutils: merged into one target to fix the issue of parallel compilation
...
Because multiple dependencies behind the context are compiled in parallel,
if they have dependencies on each other, it will cause compilation errors
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-22 13:55:55 +08:00
dongjiuzhu1
edbeb5cdd9
libs/ctype/toupper_l: Implement function toupper_l instead of macro
...
toupper_l will be replaced by toupper, resulting in infinite recursion, so implement toupper_l
stack:
0 std::__1::ctype_byname<char>::do_toupper (this=0xf3888120, c=49 '1') at libcxx/src/locale.cpp:1231
1 0x005b8188 in std::__1::ctype<char>::toupper (__c=49 '1', this=0xf3888120) at nuttx/include/libcxx/__locale:667
2 std::__1::ctype_byname<char>::do_toupper (this=0xf3888120, c=49 '1') at libcxx/src/locale.cpp:1231
3 0x005b8188 in std::__1::ctype<char>::toupper (__c=49 '1', this=0xf3888120) at nuttx/include/libcxx/__locale:667
4 std::__1::ctype_byname<char>::do_toupper (this=0xf3888120, c=49 '1') at libcxx/src/locale.cpp:1231
5 0x0064cfc9 in std::__1::ctype<char>::toupper (__c=49 '1', this=0xf3888120) at nuttx/include/libcxx/__locale:667
6 std::__1::__scan_keyword<char*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::ctype<char> > (__b=@0xf38871a0: 0xf3887220 "11:55:59 PM",
__e=0xf388722b "", __kb=0xf2c03990, __ke=0xf2c03a38, __ct=..., __err=@0xf38871b0: 0, __case_sensitive=false) at nuttx/include/libcxx/locale:299
7 0x005cb0ed in std::__1::__time_get_storage<char>::__analyze (this=0xf2c0398c, fmt=114 'r', ct=...) at libcxx/src/locale.cpp:4998
8 0x005cf888 in std::__1::__time_get_storage<char>::init (this=0xf2c0398c, ct=...) at libcxx/src/locale.cpp:5295
9 0x005d4d0f in std::__1::__time_get_storage<char>::__time_get_storage (this=0xf2c0398c, __nm=...) at libcxx/src/locale.cpp:5399
10 0x005b15c8 in std::__1::time_get_byname<char, std::__1::istreambuf_iterator<char, std::__1::char_traits<char> > >::time_get_byname (__refs=0, __nm=..., this=0xf2c03980)
at nuttx/include/libcxx/locale:2446
11 std::__1::locale::__imp::__imp (this=0xf2803970, name=..., refs=0) at libcxx/src/locale.cpp:268
12 0x005b333e in std::__1::locale::locale (this=0xf3888f00, name=0x6ca340 "C") at libcxx/src/locale.cpp:562
13 0x0058313b in helloxx_main (argc=1, argv=0xf3878810) at helloxx_main.cxx:112
14 0x0048471a in nxtask_startup (entrypt=0x5830a0 <helloxx_main(int, char**)>, argc=1, argv=0xf3878810) at sched/task_startup.c:70
15 0x00431bcd in nxtask_start () at task/task_start.c:134
16 0x0048f643 in pre_start () at sim/sim_initialstate.c:52
17 0x00000000 in ?? ()
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-22 00:07:16 +08:00
yangshuyong
0b8b5da851
fixed the unused variable caused warnning in lib_gethostbyaddrr
...
lib_gethostbyaddrr.c: warning: label 'out_copyname' defined but not used [-Wunused-label] 204 | out_copyname:
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2023-08-21 13:01:41 +08:00
fangxinyong
6c8b0ba9f3
libc/netdb: add dependence to net ip config
...
avoid to invalid enabled if no net ip config
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-21 13:01:04 +08:00
Xiang Xiao
339fc96f1f
.gitignore: Add libsamplerate
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-20 14:32:25 +03:00
Petro Karashchenko
075738cf14
net/ip: print ip addresses using ip4_addrN macro
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-19 13:28:21 -03:00
chenrun1
fb74c46e4d
arm64/gnu:Set arch_* optimizations to be on by default.
...
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-08-19 18:43:08 +08:00
zhanghongyu
88ef7e164c
getifaddrs: set sin6_scope_id when IPv6 enable
...
ifindex is also returned when obtain NIC information through getifaddrs.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-08-19 01:53:24 +08:00
anjiahao
19d1e022de
lib_psfa_adddup2:fix mem leak when failed
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-08-19 01:23:20 +08:00
fangxinyong
903e87a7bd
builtin: support uid/gid config for binfs app
...
Implement I_SUID/I_SGID feature for binfs in the POSIX compliant way.
If set-user-ID bit is set in the file permissions, then the effective
user ID of process shall be set to UID of the new process image file.
test case:
hello example emulates to set uid and file set-user-ID bit, and call
geteuid and getegid API.
UID = 2000
GID = 3000
MODE = 06555
nsh> ls -l /bin/hello
-r-sr-sr-x 2000 3000 0 hello
nsh> hello
geteuid:2000
getegid:3000
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-14 01:37:00 +08:00
yangyalei
50428979d0
fix wait after vfork return error
...
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-08-11 09:30:45 -06:00
anjiahao
fa676f264f
gdbstub:fix typo
...
CC: umm_heap/umm_zalloc.c gdbstub/lib_gdbstub.c:599:12: error: conflicting types for ‘gdb_hex2bin’; have ‘int(void *, size_t, const void *, size_t)’ {aka ‘int(void *, long unsigned int, const void *, long unsigned int)’}
599 | static int gdb_hex2bin(FAR void *buf, size_t buf_len,
| ^~~~~~~~~~~
gdbstub/lib_gdbstub.c:102:16: note: previous declaration of ‘gdb_hex2bin’ with type ‘ssize_t(void *, size_t, const void *, size_t)’ {aka ‘long int(void *, long unsigned int, const void *, long unsigned int)’}
102 | static ssize_t gdb_hex2bin(FAR void *buf, size_t buf_len,
| ^~~~~~~~~~~
gdbstub/lib_gdbstub.c: In function ‘gdb_write_memory’:
gdbstub/lib_gdbstub.c:1079:38: warning: passing argument 6 of ‘gdb_put_memory’ from incompatible pointer type [-Wincompatible-pointer-types]
1079 | addr, length, gdb_hex2bin);
| ^~~~~~~~~~~
| |
| int (*)(void *, size_t, const void *, size_t) {aka int (*)(void *, long unsigned int, const void *, long unsigned int)}
gdbstub/lib_gdbstub.c:743:49: note: expected ‘gdb_format_func_t’ {aka ‘long int (*)(void *, long unsigned int, const void *, long unsigned int)’} but argument is of type ‘int (*)(void *, size_t, const void *, size_t)’ {aka ‘int (*)(void *, long unsigned int, const void *, long unsigned int)’}
743 | gdb_format_func_t format)
| ~~~~~~~~~~~~~~~~~~^~~~~~
gdbstub/lib_gdbstub.c: In function ‘gdb_query’:
gdbstub/lib_gdbstub.c:1223:60: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
1223 | "Name: %s, State: %s, Priority: %d, Stack: %d",
| ~^
| |
| int
| %ld
1224 | tcb->name, thread_state, tcb->sched_priority,
1225 | tcb->adj_stack_size);
| ~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-08-11 20:16:17 +08:00
chao an
60c4d61c02
libs/libc/hex2bin: enhance 64-bit compatibility
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-11 19:43:37 +08:00
xuxin19
b3678b1454
cmake:support nxlib cmake compilation
...
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-10 23:18:56 +08:00
xuxin19
4668b5fa22
cmake:fix cmake nxlib build break
...
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-10 23:18:56 +08:00
liaoao
74dddfe92b
fdt: add libfdt support
...
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-08-10 20:47:37 +08:00
zhangyuan21
b705103f23
arm64: save and restore fpu regs in jmp when ARCH_FPU enabled
...
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-10 13:12:16 +08:00
fangxinyong
896f34fde9
sched: implement effective uid and gid interfaces
...
Implement 'effective' setuid, getuid, setgid, and getgid interfaces.
These will be inheritance by all child task groups. These definitons
are explicitly specified here:
https://pubs.opengroup.org/onlinepubs/000095399/functions/geteuid.html
https://pubs.opengroup.org/onlinepubs/000095399/functions/getegid.html
https://pubs.opengroup.org/onlinepubs/000095399/functions/seteuid.html
https://pubs.opengroup.org/onlinepubs/000095399/functions/setegid.html
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-09 17:07:58 +08:00
yanghuatao
3ccc5f0f76
libm/newlib: fix newlib build error
...
Fix error :
nuttx/libs/libm/newlib/include/math.h:89:8: error: ‘_Thread_local’ does not name a type; did you mean ‘thread_local’?
89 | extern _Thread_local int _tls_gamma_signgam;
| ^~~~~~~~~~~~~
| thread_local
In file included from /mnt/nuttx/include/libcxx/math.h:300,
from /mnt/nuttx/include/libcxx/cmath:308,
from /mnt/nuttx/include/libcxx/charconv:79,
from libcxx/src/string.cpp:10:
/mnt/nuttx/libs/libm/newlib/include/math.h:89:8: error: ‘_Thread_local’ does not name a type; did you mean ‘thread_local’?
89 | extern _Thread_local int _tls_gamma_signgam;
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-08-08 19:41:58 -03:00
Petro Karashchenko
aa3eeaa62a
libs/libc: use _SCHED_GETPID in getpgrp implementation
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Petro Karashchenko
d113722eb2
style: fix indentation issues
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Petro Karashchenko
1b0baa8337
nuttx: use lib_free for memory de-allocation after strdup or asprintf
...
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
cuiziwei
7c8bb8c293
nuttx/tls: Remove the max key limiatation in task_tls_alloc and pthread_key_create
...
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2023-08-05 06:33:49 -07:00
cuiziwei
5334c065b4
nuttx/tls:Setting the candidtate index to null prevents dangling pointers.
...
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2023-08-05 06:33:49 -07:00
cuiziwei
8ffde7cf16
nuttx/tls:Setting the candidtate index to null prevents dangling pointers.
...
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2023-08-05 06:33:49 -07:00
zhangyuan21
699c401889
libc: update arm-m memset function
...
Use the memset function in bionic for better performance.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-03 21:15:50 -07:00
yinshengkai
26fc59bc35
libc/stdio: changed LIBC_NL_ARGMAX default value to 9
...
If LIBC_NL_ARGMAX is too large, the stack usage of printf family functions will increase
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-03 19:07:22 -07:00
zhangyuan21
a10cc49e67
Revert "newlib: libc: memcpy M-profile PACBTI-enablement"
...
This reverts commit 9fa097ab69
.
2023-08-03 07:03:39 -07:00
fangxinyong
2bf434214e
libc/sysconf: add _SC_REALTIME_SIGNALS
...
pass ltp case: open_posix_testsuite/conformance/interfaces/sigwait/7-1.c
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:57:28 -07:00
fangxinyong
da3a75da2c
libc/net: compatible with Android for htonq/ntohq
...
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:47:29 -07:00
zhangyuan21
3625385541
arch_memcpy: Optimize arch memcpy for armv7-m and armv8-m
...
Use ldm and stm instruction to optimize performance when
both src and dst are 32-bit aligned.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-02 16:52:25 +02:00
dongjiuzhu1
1920ff31d3
libs/libc/gpsutils/minmea: move minmea library from apps/gpsutils
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-01 23:09:46 -07:00
yangyalei
6a5cf6d3ff
ltp: fix review questions
...
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-08-01 09:35:36 -07:00
yangyalei
f40eee50d6
pwd: Add initial implementation of getpwent
...
fix ltp sigqueue testcase crash in getpwent:
nsh> ltp_sigqueue_3_1
core dumped
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
4ecff53e2c
sigaltstack: Add initial implementation of sigaltstack
...
fix ltp testcase compile error:
ltp/testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c:16:13: \
error: ‘sigaltstack’ undeclared (first use in this function)
16 | dummyvar = sigaltstack;
| ^~~~~~~~~~~
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
ed705f9cb3
sysconf: add _SC_THREAD_THREADS_MAX response
...
fix ltp_pthread_create_s_c1 test get wrong PTHREAD_THREADS_MAX.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
dongjiuzhu1
5d09b4cbd0
libc/rand_r: support rand_r api
...
refs to https://pubs.opengroup.org/onlinepubs/7908799/xsh/rand.html
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 07:28:23 -07:00
dongjiuzhu1
afb473707f
libc/pthread: add pthread_attr_set/getscope
...
refs to https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_attr_setscope.html
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 20:55:22 -07:00
guoshichao
02153a2afb
pthread_atfork: fix the incorrect description in comments
...
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 04:51:13 -07:00
guoshichao
9d7f349664
libs/pthread/pthread_atfork: fulfill implement pthread_atfork function
...
1. add the pthread_atfork implementation
2. the pthread_atfork implementation are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 10:41:52 +02:00
guoshichao
3524f4b9ce
libs/libc/fork: add lib_fork implementation
...
1. add lib_fork api in libs/libc, we need a fork() api to implement the
fork relative method, such as pthread_atfork
2. rename the assembly fork entry function name to up_fork(), and rename
the up_fork() to arch specific name, such as
sim_fork()/arm_fork()/mips_fork() etc.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 10:41:52 +02:00
Xiang Xiao
f3269a6caa
sched: Rename DEBUG_TCBINFO to ARCH_HAVE_TCBINFO
...
and select if the arch support to define g_tcbinfo variable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-26 09:33:38 +02:00
Tiago Medicci Serrano
a5c92582a4
Rename CamelCase symbols to lowercase
2023-07-25 08:51:17 -07:00
Alan Carvalho de Assis
35ec548033
Remove empty lines with spaces found in the source code
2023-07-25 08:51:17 -07:00
Neale Ferguson
ed4f651bbd
Fix modlib to get binary loading working again
...
This patch fixes the issue reported here:
https://github.com/apache/nuttx/issues/9845
2023-07-25 08:51:17 -07:00
Zhe Weng
9dc5a59d50
libc/netdb: Move dns query info and buffer out of the stack
...
The length of these buffers come from Kconfig, it isn't safe to allocate
them on the stack.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-25 06:17:48 -07:00
guoshichao
714926e6ea
libs/libc/strftime: add modifier character support to strftime
...
1. make the ltp/open_posix_testsuite/strftime 2-1.c case
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-24 10:34:23 -07:00
guoshichao
0092b3e30f
sched/signal/sig_nanosleep: fix the clock_nanosleep posix case
...
1. make the clock_nanosleep can pass
ltp/open_posix_testsuite/clock_nanosleep 13-1, 10-1, 9-1 cases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_nanosleep.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-23 22:02:03 -07:00
anjiahao
9f644579b3
fix sim register & tcb info typo
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-23 21:59:35 -07:00
chao an
4b94dc3092
toolchain/gcc: fix linker error if enable STACK_CANARIES/LTO at same time
...
If -fstack-protector-all is enabled, gcc linker will need GCC
SSP(Stack Smashing Protector) support, Since the implement of SSP
is related to the OS, most of embedded toolchain does not provide
ssp support, so an error will be reported when linking:
enable CONFIG_LTO_FULL && CONFIG_STACK_CANARIES
arm-none-eabi/bin/ld: cannot find -lssp_nonshared: No such file or directory
arm-none-eabi/bin/ld: cannot find -lssp: No such file or directory
https://github.com/gcc-mirror/gcc/blob/master/gcc/gcc.cc#L983-L985
Since nuttx has already implemented SSP related hook functions,
so in this PR, we filter out this option in the link phase to ensure that
the implementation of lssp/lssp_nonshared will not be referenced
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-21 01:13:34 +08:00
zhanghongyu
3c359da8b9
dns: print dns server address when query failed
...
When debugging the actual dns resolution failure encountered, it is found
that if you know the address of dnsserver, the difficulty of debugging the
problem is reduced.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-20 08:11:57 +02:00
Xiang Xiao
a51be33a41
libc/tls: Change the default value of TLS_NELEM to zero
...
to ensure the default config as small as possible.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-20 08:11:30 +02:00