In circbuf_get_read/writeptr, when circbuf is full, off == pos, and
*size = off - pos = 0. So add circbuf_is_full() condition to return
correct *size.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Follow the elf format, correct the memory region flag description:
Executable 0x1, Writable 0x2, Readable 0x4
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
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>
nuttx\libs\libc\misc\lib_bitmap.c(1,1): warning C4819: The file contains a character that cannot
be represented in the current code page (936).
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
[263/1096] Building C object libs/libc/CMakeFiles/c.dir/misc/lib_pathbuffer.c.obj
ctc W574: ["libs/libc/misc/lib_pathbuffer.c" 144/3] 'return' with an expression in function returning void
Signed-off-by: chao an <anchao@lixiang.com>
and move common math funtions to math32.h:
div_round_up
div_round_closest
is_power_of_2
roundup_pow_of_two
rounddown_pow_of_two
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
Using the ts/tick conversion functions provided in clock.h
Do this caused we want speed up the time calculation, so change:
clock_time2ticks, clock_ticks2time, clock_timespec_add,
clock_timespec_compare, clock_timespec_subtract... to MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
The standard describes trylock as follows, trylock should never cause the system to stop running:
The pthread_mutex_trylock() function shall be equivalent to
pthread_mutex_lock(), except that if the mutex object referenced by
mutex is currently locked (by any thread, including the current thread),
the call shall return immediately.
https://linux.die.net/man/3/pthread_mutex_trylock
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Summary:
If we disable LIB_PATHBUFFER_MALLOC, that when the path buffer is insufficient, NULL is returned to avoid applying for a buffer from the heap.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Summary:
Since there is a default definition for CONFIG_SMP_NCPUS in sys/types.h, we can remove #ifdef and return CONFIG_SMP_NCPUS directly.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Summary:
1.Remove the macro definition of getnproc in sysinfo
2.New get_nprocs_conf and get_nprocs interfaces, return CONFIG_SMP_NCPUS, return 1 when not defined
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This is a tool for associating discrete IDs with addresses.
This tool is implemented through the red-black tree method provided by <sys/tree.h>, and the time complexity when calling, searching, and deleting is optimized to O(logn)
The implementation is the moving node operation of two red-black trees
1. When applying for a node, it will first check whether there is an available node in the "removed" tree. If so, the memory address of the node will be reused and moved to the "alloced" tree.
2. If the "removed" tree is an "empty tree", then the node will be requested from the memory and added to the "alloced" tree
3. Similarly, when removing a node, we set the address pointed to in the node to "NULL" and move it to the "removed" tree. Next time we alloc the node, we can reduce the overhead caused by memory application
For now, we still have something that can be optimized, and that is the memory elimination mechanism of the "removed tree". The current implementation will only release all the content under the "removed" tree when the idtree is destroyed.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
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>
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>
Add registration function instrumentation API,
which can achieve instrumentation of entering and
exiting functions through the compiler's functionality.
We can use CONFIG_ARCH_INSTRUMENT_ALL to add instrumentation for all
source, or add '-finstrument-functions' to CFLAGS for Part of the
source.
Notice:
1. use CONFIG_ARCH_INSTRUMENT_ALL must mark _start or entry noinstrument_function,
becuase bss not set.
2. Make sure your callbacks are not instrumented recursively.
use instrument_register to register entry function and exit function.
They will be called by the instrumented function
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Binary nibble to/from ascii hex conversion was buggy on both
lib_slcdencode and lib_slcddecode libraries.
This bug caused the slcd library to fail to decode 5-byte sequence command
which have 'count' argument value bigger than 0x9.
Signed-off-by: Federico Braghiroli <federico.braghiroli@gmail.com>
This moves all the public POSIX semaphore functions into libc and with
this most of the user-space logic is also moved; namely cancel point and
errno handling.
This also removes the need for the _SEM_XX macros used to differentiate
which API is used per user-/kernel mode. Such macros are henceforth
unnecessary.