Commit Graph

1765 Commits

Author SHA1 Message Date
p-szafonimateusz e6553eee5a libc/x86_64: port string functions from bionic
port optimized string functions for x86_64 from Bionic (BSD licensed)

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-07-02 23:59:18 +08:00
buxiasen 7445c97c77 libc: scanf, printf %z change switch const to if
switch const will cause a switch_selector_expr_is_constant
warning catched by coverity.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-07-02 02:57:00 +08:00
buxiasen b08d219849 mkstemp: permission 0666 to 0600
https://man7.org/linux/man-pages/man3/mkstemp.3.html
remove the read/write permission of other users for temp file

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-07-02 02:56:05 +08:00
fangpeina 242b50f921 libc/execinfo: extract a common backtrace format function
Add a common method to format backtrace to buffer, so it can be used by both mm, fs and other possoble modules.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-06-29 22:44:39 +08:00
p-szafonimateusz c932fe3045 libm/newlib: disable optimization for sincos
Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-06-28 01:26:18 +08:00
p-szafonimateusz 23b2f96c9d libm/libm: disable optimization for sincos
Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-06-28 01:26:18 +08:00
Huang Qi a14d94c548 gdbstub: Minor style fix
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-06-26 10:19:14 -03:00
zhanghongyu e14ae3e681 pthread: add pthread_self/pthread_gettid_np function
explicitly defined functions can support assignment as function pointers

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-26 17:40:55 +08:00
anjiahao 1b2ad4ff7d gdbstub: fix typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-06-26 00:20:58 +08:00
Huang Qi add8b71fee serial/gdbstub: Change GDBSTUB_ to GDB_
Fix nameing convention inconsistent

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-06-24 23:51:43 +08:00
anjiahao 3c7162338d gdbstub:support gdbstub_debugpoint_add/remove smp call
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-06-24 23:51:43 +08:00
Xiang Xiao e9558a88cd gdbstub: Change GDBSTUB_ to GDB_
Make the naming convention more consistent

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-06-24 23:51:43 +08:00
Yanfeng Liu 3b1f4562a0 sched/tls: drop ta_argv and g_idleargv
- replaces `ta_argv` with `stackargs`
- drops `ta_argv` from `task_info_s`
- drops `g_idleargv` and checks idle accordingly

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-23 22:24:19 +08:00
Yanfeng Liu 8ebc3aa9e8 arch/risc-v: initial qemu-rv64ilp32 support
This applies uintreg_t in risc-v commons and fixes araised ci issues
for multiple devices. The FLAT build runs on qemu-rv64ilp32 target.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-14 19:50:00 +08:00
zhanghongyu ee4c25f34e sem_open: return error code, sem returned by parameter
pointer comparison is unsigned, when returning -errno will be converted
to a large positive number, can not enter the error handling branch,
therefore, the error code is returned directly and the sem is returned
through the parameters.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-06 02:40:50 +08:00
raiden00pl 105e4f44d4 libdsp: fix gcc14 error and clean up includes 2024-06-02 09:27:36 -03:00
raiden00pl 13fa50c94a cmake: fix compilation
there is no spawn/lib_task_spawn. file
2024-06-02 09:27:36 -03:00
anjiahao 3312ab2087 gdbstub:fix get thread rsp command crash
riscv-gdb/gdb/thread.c:1309: internal-error: void switch_to_thread(thread_info*): Assertion `thr != NULL' failed.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-05-31 23:19:18 +08:00
Huang Qi 047c9fce40 libc.csv: Guard execv with LIBC_EXECFUNCS
execv only available if LIBC_EXECFUNCS enabled.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-05-29 20:37:12 +08:00
yinshengkai 20ebe0e64c Replace all asserts in kernel code with ASSERT
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-05-17 10:18:16 -03:00
simbit18 d1789d84e8 fix nxstyle
fix Relative file path does not match actual file.
2024-05-13 22:24:36 +02:00
simbit18 09bfaa7292 fix nxstyle
fix Relative file path does not match actual file.
2024-05-11 01:19:06 +08:00
zhanghongyu 908814a575 libc/lib_bzero:Add bzero prototype.
Implement the bzero function as an alternative to macro expansion.

and support gcc FORTIFY_SOURCE features for nuttx libc

This function will use gcc's function
__builtin_dynamic_object_size and __builtin_object_size

Its function is to obtain the size of the object through compilation,
so as to judge whether there are out-of-bounds operations in commonly used functions.
It should be noted that the option -O2 and above is required to enable this function

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-05-07 14:59:05 +02:00
yinshengkai b87804c2ba libc/string: replace __builtin_ffsl with inline function
In the gcc-riscv compiler, __builtin_ffs will call ffs, and calling __builtin_ffs in ffs will cause recursion

Change ffs to an inline function, and compile ffs implemented by nuttx by default.
Only call the implementation of nuttx when the compiler cannot provide an ffs implementation.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-04-30 19:47:08 +08:00
Philippe Leduc 3dc6b4c9bd Add basic support for locales in order to C++ streams to build and work for simple cases (POSIX / C locale).
Fix build with C++ GCC toolchain
2024-04-29 17:34:10 +08:00
Juha Niskanen 3348d03f95 libs/libc/inttypes: add support for imaxdiv
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2024-04-23 10:26:48 -03:00
xuxin19 859247c224 cmake:enhance set_source_files_properties for NuttX CMake module
Because `set_source_files_properties` in cmake will overwrite the properties instead of appending them.
This module implements addition and deletion by
first `getting_source_file_property` and then `set_source_files_properties`

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
Michal Lenc 9798674f27 libc: add support for reallocarray
This commit adds support for reallocarray function. The functionality
is the same as for standard realloc, but the function also checks for
multiplication overflow and fails safely in case it occurs.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-04-17 11:36:39 -03:00
Huang Qi 4bcb33926e libc.csv: Fix macro guard for TLS related symbols
The current macro guard for TLS related symbols is
not enough, only if !defined(CONFIG_DISABLE_PTHREAD)
and CONFIG_TLS_NELEM > 0, the TLS related symbols
will enabled.

So if CONFIG_DISABLE_PTHREAD is not defined, but
TLS is disabled, the reference to TLS related symbols
will cause build error (undefined reference to xxx).

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-04-17 19:45:26 +08:00
simbit18 7677f10d3f fix nxstyle
fix Relative file path does not match actual file.
2024-04-16 19:09:12 +08:00
hujun5 638716504d fdcheck: update fdcheck impl
1 store fd in the high position
2 removing the pid information , as the tag information is sufficient.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-04-11 10:45:44 +08:00
shizhenghui be48a913cc audio/libsrc: fix build warning
libsamplerate/src/samplerate.c:468:5: warning: "CPU_CLIPS_POSITIVE" is not defined, evaluates to 0 [-Wundef]
  468 | #if CPU_CLIPS_POSITIVE == 0
      |     ^~~~~~~~~~~~~~~~~~

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-26 09:40:42 +08:00
shizhenghui 510d55a783 audio/libsrc: move download path to libs/libc/audio/libsrc
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-26 09:40:42 +08:00
Alan Carvalho de Assis 97e217b0ff libc/uname: Add option to disable uname timestamp
Don't include the build timestamp into final binary when the symbol
CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP is defined.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-03-23 11:42:22 +08:00
chao an d4d49e9645 stdio/file: unify group file list to common single queue
unify group file list to common single queue

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-18 19:32:49 +08:00
xuxin19 2c9d46f176 cmake:enable libxx for CMake build
distinguish whether to add the CXX header file search path
according to the target Language.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:28:53 +08:00
wangmingrong d4b5991589 libcxxabi: Path <cxxabi.h> not found
./helloxx_main.cxx:29:10: fatal error: cxxabi.h: No such file or directory
   29 | #include <cxxabi.h>
      |          ^~~~~~~~~~
CONFIG_LIBCXXABI is turned on, but the library include is not linked to nuttx/include, causing the compilation to fail.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:47:55 +08:00
Juha Niskanen 47026978bf libs/libc/string: fix memmem() boundary case when needle is at end of haystack
This fixes calls like memmem("hello", 5, "lo", 2);

Also zero-length needle is deemed to exist at beginning of haystack.
This behavior matches memmem() on Linux, FreeBSD, NetBSD and OpenBSD.

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2024-03-11 22:06:19 +08:00
hujun5 577eb47966 fdcheck: Enable fdcheck to automatically detect ownership of fd
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-03-07 09:08:48 +08:00
trns1997 54e9e582d5 Use C++ standard lib from toolchain
Signed-off-by: trns1997 <trns1997@gmail.com>
2024-03-06 08:42:44 +08:00
chao an 8592e7e009 sched/task: save argument counter to avoid limit check
The maximum startup parameters have been checked accordingly in nxtask_setup_stackargs(),
let us save argument counter to avoid limit check.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-05 22:25:28 +08:00
chao an 954bffcbd7 sched/tls: inline group info in flat mode to improve performance
inline group info in flat mode to improve the task create/destroy performance

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-01 17:27:26 +08:00
p-szafonimateusz e967be059a newlib: fix compilation for sincosl
aggresive optimisation can replace occurrences of sinl() and cosl() with
sincosl(), but sincosl() is missing in newlib which causes error. So let's
use custom implementation here.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 23:56:47 +08:00
p-szafonimateusz 5288e063ec newlib: fix support for x86
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 23:56:47 +08:00
p-szafonimateusz 9b0017659c arch/x86_64: add cmake support
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-23 07:45:57 +08:00
chenrun1 5c6bd833ed fs_lock:Implementing file locks
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
guohao15 b36521d4a4 hsearch_r: add DELETE action
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-02-21 13:29:36 -03:00
guohao15 4fd175fd5c api: add simple hashtable api
merge form OpenGroup
https://pubs.opengroup.org/onlinepubs/009696899/functions/hcreate.html

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-02-21 13:29:36 -03:00
chao an 39a0e6fa74 toolchain/lto: enable lto flags only on GNU toolchain
Some commercial customized toolchains do not support these options

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-18 00:47:53 -08:00
Petro Karashchenko 5495ff4d78 libs/libxx: add patch to remove mach/mach_time.h inclusion
Inclusion of mach/mach_time.h by libcxx/src/chrono.cpp breaks
the build on latest MACOS dues to https://forums.developer.apple.com/forums/thread/746737
The interface from mach/mach_time.h is not referenced in chrono.cpp
so it is safe to remove it

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-02-16 10:42:23 -08:00