Commit Graph

1560 Commits

Author SHA1 Message Date
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