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
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
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
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
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
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
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
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
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