Commit Graph

1999 Commits

Author SHA1 Message Date
chenzhijia b63cffe000 libs/libc/unistd:Fix errcode not return normally
Exit the program and return errcode when ioctl fail

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia d52074a9cb libs/libc/unistd: add getspnam function
Add getspnam function to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia 2a328279ca libs/libc/unistd: add crypt function
Add crypt function to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia ad70ca33c8 libs/libc/unistd: add getpass function
Add getpass function to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
chenzhijia c0039d6623 libs/libc/pwd: add new member to passwd struct
Add pw_passwd member to pass tlpi example:
https://man7.org/tlpi/code/online/dist/users_groups/check_password.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-16 11:15:25 +08:00
Xiang Xiao 5397a58731 libc/modlib: Make modlib selectable from defconfig
since bootloader may call modlib functions directly
to load elf firmware without binfmt, dlfcn or module.

BTW, this patch also remove the duplicated selecttion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-16 10:11:20 +08:00
liwenxiang1 3fd75efed9 Revert "libs/libc:Openlibm adds exp10 and exp10f function implementations"
This implementation is from glibc, and the license is LGPL

This reverts commit 862244586976b9388f87dc639225d714dd70e4af.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-16 08:03:31 +08:00
raiden00pl c393416580 libs/libxx: uClibc depends on CONFIG_ALLOW_GPL_COMPONENTS=y
uClibc is LGPL so it should depends on CONFIG_ALLOW_GPL_COMPONENTS=y
2024-10-16 07:56:50 +08:00
cuiziwei 9d9857acd2 Change the judgment of GCCVER version to greater equal.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-15 23:32:13 +08:00
anjiahao ae126a8065 lib_stdoutstream:need return write size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-15 23:30:57 +08:00
likun17 9de0465a8a lib_libvsprintf.c:add option in Kconfig to control "%p*" special format specifier.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-15 15:33:13 +08:00
likun17 83914d5b29 lib_libvsprintf.c: Add support for %pB parameter.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-15 15:33:13 +08:00
hujun5 a567148888 sched: add up_this_task and up_change_task macro stub
reason:
We can utilize percpu storage to hold information about the
current running task. If we intend to implement this feature, we would
need to define two macros that help us manage this percpu information
effectively.

up_this_task: This macro is designed to read the contents of the percpu
              register to retrieve information about the current
              running task.This allows us to quickly access
              task-specific data without having to disable interrupts,
              access global variables and obtain the current cpu index.

up_update_task: This macro is responsible for updating the contents of
                the percpu register.It is typically called during
                initialization or when a context switch occurs to ensure
                that the percpu register reflects the information of the
                newly running task.

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-15 15:25:55 +08:00
Bowen Wang 71ee767fe2 vsprintf:fix bug when print int64 0x8000000000000000
stdio/lib_libvsprintf.c:1018:17: runtime error: negation of -9223372036854775808 cannot be
represented in type 'long long int'; cast to an unsigned type to negate this value to itself
    #0 0x3326a86 in vsprintf_internal stdio/lib_libvsprintf.c:1018
    #1 0x332926b in lib_vsprintf stdio/lib_libvsprintf.c:1363
    #2 0x3777978 in vfprintf stdio/lib_vfprintf.c:52
    #3 0x671b3a0 in printf stdio/lib_printf.c:44
    #4 0x37abc0c in hello_main /data/project/code/vela-pt/apps/examples/hello/hello_main.c:38
    #5 0x33201d3 in nxtask_startup sched/task_startup.c:70
    #6 0x3208ecb in nxtask_start task/task_start.c:134
    #7 0x3357a49 in pre_start sim/sim_initialstate.c:52

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-15 08:14:59 +02:00
cuiziwei bbf60ec685 gnu++20:fix ld error.
LD: nuttx
arm-none-eabi-ld: warning: net_sendfile.o: missing .note.GNU-stack section implies executable stack
arm-none-eabi-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
arm-none-eabi-ld: warning: nuttx/nuttx has a LOAD segment with RWX permissions
arm-none-eabi-ld: apps/staging/libfeature.a(feature_framework.cpp.frameworks.base.feature_1.o): in function `std::__1::__throw_length_error[abi:un170006](char const*)':

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-15 12:57:52 +08:00
Gao Jiawei 89d6abf3df setjmp: fix setjmp returns 0 when calling longjmp with 0 as the second argument
Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
2024-10-15 12:36:19 +08:00
cuiziwei 036a0674db nuttx/libc:Add _dl_find_object and dl_iterate_phdr function.
Add _dl_find_object() function, because when cxx_exception configuration is enabled, a link error occurs and that function cannot be found.

ld: /usr/lib/gcc/x86_64-linux-gnu/13/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `_Unwind_Find_FDE':
(.text+0x250c): undefined reference to `_dl_find_object'

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-15 12:35:54 +08:00
anjiahao 4156eca0c1 modlib:so need export symbol, exec elf not need
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-15 03:20:05 +08:00
anjiahao 19b8fdbad6 modlib:allow 64bit elf load
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-15 03:20:05 +08:00
ligd 7d218f93fa libc: add nx_strdup() & nx_strndup() support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-15 01:16:48 +08:00
chao an 39c1c871a0 Revert "libc/atomic: decoupling atomic and spinlock to avoid recursion"
This reverts commit c37b0de28c.
2024-10-14 17:42:16 +08:00
cuiziwei 7246533aeb Unify the definition of GCCVER and remove duplicate code.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-13 11:41:22 +08:00
zhanghu5 f8f6bfff29 use r1-r3 as tmp register
Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2024-10-13 10:12:27 +08:00
chao an c37b0de28c libc/atomic: decoupling atomic and spinlock to avoid recursion
1. use irq save in AMP mode
2. use critical section in SMP mode

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-13 10:00:22 +08:00
yinshengkai 38e474b0c5 libc: add CRC-8-ROHC support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-13 03:09:26 +08:00
Bowen Wang 821196eb22 lib_uuid_create: try use hardware random number generators first
Try the hardware random number generators is better for uuid generator

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-13 02:44:25 +08:00
liwenxiang1 8d09eaaee0 libs/libc:Openlibm adds exp10 and exp10f function implementations
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-13 02:31:44 +08:00
liwenxiang1 1c65fbf15a libc/newlib:Declaration of adding depth
Resolve the issue of inability to compile when opening newlib

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-13 02:30:51 +08:00
Bowen Wang 101b147a24 lib_memoryregion: fix the comments about the memory flags
Follow the elf format, correct the memory region flag description:
Executable 0x1, Writable 0x2, Readable 0x4

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-13 02:28:55 +08:00
xuxin19 351781d601 cmake:refine nuttx cmake build system fix CMake build missing part
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-13 02:25:06 +08:00
Bowen Wang b5b0430c39 net/vsock: add AF_VSOCK address family
Add AF_VSOCK address family support, This is the vsock framework
preparation patch.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-13 02:02:03 +08:00
wangmingrong1 6e12b3d74b libc/utsname: Only store version in RAM, use rodata for all others
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-12 15:36:28 +08:00
wangmingrong1 f233c5860c libc/lib_utsname: Store version number for debugging and preventing optimization
In order to directly read the version information of the current file from elf or bin files, memory files, etc., for easy debugging and one-to-one correspondence.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-12 15:36:28 +08:00
liwenxiang1 056aa3c816 libs/libc: Optimize the stack space of lib_vsprintf by splitting arglist into type and value
Dynamically apply for memory based on numargs

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>

libs/libc: Resolve the issue of undefined behavior when UBSAN is enabled on SIM

If numargs equals 0, it is set to 1 by default

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-12 14:35:49 +08:00
zhanghongyu 3c3865bce0 netdb: fix may add duplicate DNS servers
struct sockaddr_in
{
  sa_family_t     sin_family;
  in_port_t       sin_port;
  struct in_addr  sin_addr;
  uint8_t         sin_zero[8];
};

sin_zero is probably a random number.

struct sockaddr_in6
{
  sa_family_t     sin6_family;
  in_port_t       sin6_port;
  uint32_t        sin6_flowinfo;
  struct in6_addr sin6_addr;
  uint32_t        sin6_scope_id;
};

sin6_flowinfo and sin6_scope_id is probably a random number.

Random numbers cause the same server configuration check failed,
so let's initialize it.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-12 14:20:08 +08:00
hujun5 b96a753747 libs/libc: There is no need to use sched_[un]lock
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-12 13:28:23 +08:00
anjiahao 0dd5228259 modlib:if use LMA, not set bss
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 4f92d7aafd modlib:Allow loading elf from block devices
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 434442d707 modlib:move modlib_findsection to common headfile
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
dongjiuzhu1 a3f3918198 binfmt/modlib: move modlib_sectname to public
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 2be58054bb modlib_bind:add new args export and nexport to modlib_bind
if modp is NULL, we can use export and nexport load externl symbol

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 1fc2cd7816 binfmt:use modlib api inside of elf api [1/2]
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 2931d1e85f modlib:support modlib can load exec
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 9c191e93b7 modilib:add new args to modp record init arry
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao e9550783d3 modlib:add new api to uninitialize modp
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 91c7e8e44b modlib:move Exception section logic to modlib
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao dfc5e4dd55 modlib:Move addrenv logic to modlib
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 4ec4c5e1b4 modlib:fix bug when read modlib sections name
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 489223f0d5 modlib:move get file info logic to modlib
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00
anjiahao 18d113e06e modlib:move elf LMA logic to modlib
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 12:29:06 +08:00