Commit Graph

1207 Commits

Author SHA1 Message Date
Xiang Xiao
6f6fce95a2 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
6354a742f1 libc: Add a new argument(size_t fulllen) to lib_getfullpath
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
chao an
d6747dd6ad libc/armv8-m: fix build break if MVE is disabled
machine/arm/armv8-m/gnu/arch_memcpy.S: Assembler messages:
machine/arm/armv8-m/gnu/arch_memcpy.S:105: Error: bad instruction `prologue push_ip=HAVE_PAC_LEAF'
machine/arm/armv8-m/gnu/arch_memcpy.S:121: Error: bad instruction `epilogue push_ip=HAVE_PAC_LEAF'
make[1]: *** [Makefile:143: bin/arch_memcpy.o] Error

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-05 08:07:08 +02:00
zhangyuan21
73257eeda0 libs/libc: fixed armv7-m strcmp build issue
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-04 11:59:41 -04:00
zhangyuan21
884be2bdb9 assert: Distinguish between assert and exception
CURRENT_REGS may change during assert handling, so pass
in the 'regs' parameter at the entry point of _assert.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-03 14:49:32 +08:00
Stuart Ianna
4e2a8d4492 libc: Add setbuffer to stdio.
The setbuffer() function is a wrapper around setvbuf() which
enables full buffering on a buffer allocated by the caller, assuming
buffer is not a null pointer.
2023-05-01 11:24:41 +03:00
chao an
9fa097ab69 newlib: libc: memcpy M-profile PACBTI-enablement
Add function prologue/epilogue to conditionally add BTI landing pads
and/or PAC code generation & authentication instructions depending on
compilation flags.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-28 09:51:52 +08:00
chao an
5945f080b9 boars/spawn_proxy: remove all CONFIG_POSIX_SPAWN_PROXY_STACKSIZE
Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-27 17:35:58 +08:00
dongjiuzhu1
68d40d4a98 libc/locale: support iconv_open,iconv,iconv_close
Refs to:https://github.com/bminor/musl

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-04-25 19:12:53 +01:00
Xiang Xiao
28eca64dd5 libc: Cleanup per-thread resource in exit/quick_exit
copy from pthread_exit to avoid the resource leak

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-25 16:52:08 +03:00
hujun5
d189a86a35 system: pthread_barrierwait should be moved to kernel space
The current implementation requires the use of enter_critical_section, so the source code needs to be moved to kernel space

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-04-25 15:34:40 +08:00
hujun5
5a2bc1c015 system: pthread_barrierwait can not be preemption
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-04-25 15:34:40 +08:00
chao an
2be18a8b24 makefile: fix libc/mm files can not be compiled incrementally
Use double delim to fix windows native build and give an error:
makefile:132: *** target mode do not include“%”. stop.

In Windows environment DELIM := $(strip \) but \ has two role:
first: \ as directory, and second \ as Escape character, Reference:

https://github.com/apache/nuttx/pull/7572#discussion_r1028219229

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-24 12:43:10 +03:00
Zhe Weng
d8da8dcc44 libc: Print error code for unknown errors in strerror/gai_strerror
Ref: Linux print unknown errors like "Unknown error nnn"
https://man7.org/linux/man-pages/man3/strerror.3.html#RETURN_VALUE

Note:
These interfaces are called at low freq, so a static buffer may be enough.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-04-22 01:46:39 +08:00
Stuart Ianna
4cae98674d litex: Support for kernel build with vexriscv-smp. 2023-04-22 01:40:32 +08:00
Petro Karashchenko
733807f635 libs/libc/string: make strsignal() configurable similar to strerror()
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-04-22 01:26:42 +08:00
Fotis Panagiotopoulos
098b7bbfb3 Fixes in asprintf usage. 2023-04-19 02:48:39 +08:00
XinStellaris
57df1ddcbb Add armv7m assembly strcpy.
Signed-off-by: XinStellaris <tianxin7@xiaomi.com>
2023-04-10 18:59:52 +03:00
Petro Karashchenko
3513c53a09 libs/libc/pthread: fix function name in comments
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-04-07 12:28:45 -03:00
chao an
4fbf5f7a4b libs/libc: correct config define of arch functions
Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-04 09:37:46 -03:00
chao an
3c58f5db2b syscall/libc: add more syscall/libc symbols into csv file
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-31 21:56:50 +09:00
Stuart Ianna
01b0305ab5 risc-v: SV32 MMU support for qemu-rv. 2023-03-29 22:15:19 +09:00
Fotis Panagiotopoulos
0b1ba70ac5 asprintf: Fixed possible memory leak if print fails. 2023-03-28 14:46:07 -03:00
Gregory Nutt
717bb04cb7 Increase the number of real time signals. Two is not enough.
Refer to issue #8867 for details and rational.

Convert sigset_t to an array type so that more than 32 signals can be supported.

Why not use a uin64_t?
- Using a uin32_t is more flexible if we decide to increase the number of signals beyound 64.
- 64-bit accesses are not atomic, at least not on 32-bit ARMv7-M and similar
- Keeping the base type as uint32_t does not introduce additional overhead due to padding to achieve 64-bit alignment of uin64_t
- Some architectures still supported by NuttX do not support uin64_t
  types,

Increased the number of signals to 64. This matches Linux. This will support all xsignals defined by Linux and also 32 real time signals (also like Linux).

This is is a work in progress; a draft PR that you are encouraged to comment on.
2023-03-27 16:59:04 +03:00
Petro Karashchenko
4309c6693c libc/modlib: fix indentation issue
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-26 09:23:50 -06:00
Xiang Xiao
beb38917d1 signal: Replace NuttX special SIGWORK with SIGPAGING(SIGRTMIN)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-26 08:31:36 -06:00
chao an
3428d15d04 libc/math: rename libc/math.csv to libm/libm.csv
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-24 14:58:10 -03:00
Petro Karashchenko
5651715486 signal: remove unused SIGCONDTIMEDOUT
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-23 17:17:25 -06:00
chao an
c839fc45af libc/settimeofday: correct prototype of settimeofday()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-21 11:16:30 -03:00
Xiang Xiao
b63994b7f7 drivers/serial: Always support c_oflag, c_iflag and c_lflag in termios
CONFIG_SERIAL_TERMIOS only decide whether to support c_cflag field since
many terminal application need the first three fields to work correctly.
For more information please reference:
https://www.mail-archive.com/dev@nuttx.apache.org/msg09321.html

before this change(olimexino-stm32:tiny):
   text    data     bss     dec     hex filename
  34884     328    1768   36980    9074 nuttx
after this change:
   text    data     bss     dec     hex filename
  35052     340    1768   37160    9128 nuttx
delta
   text    data     bss     dec     hex filename
    168      12       0     180      b4 nuttx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-19 14:54:59 -06:00
zhangyuan21
cf56e4113a arch: remove unnecessary sem_setprotocol code
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-17 16:53:19 -03:00
yinshengkai
1cc3fd59ed libc/syslogstream: fix nxstyle error
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-13 22:24:53 +02:00
yinshengkai
ca290e85ea libc: stream adds length check
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-13 22:24:53 +02:00
Karel Kočí
62661600b2 treewide: add DOWNLOAD variable as unification of curl call
This is a followup to the commit
03b164f59c.
2023-03-08 17:05:05 +08:00
yinshengkai
81a4f21f1b libc/libvsprintf: use puts to replace the putc
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-08 16:56:17 +08:00
yinshengkai
b8e622ea5d libc/stream: unify stream behavior
Return the error code when all gets occur when an error is wrong
and return immediately when obtaining any valid data

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-04 01:48:22 +08:00
yinshengkai
205ca26556 libc/streams: Implement gets/puts for all streams
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-03 00:49:04 +08:00
Huang Qi
dfc70b1ddb libc/stdio: Implement lib_get_stream
Use lib_get_stream() to fetch stdin/stdout/stderr,
since is more easy to works with other language by function call
than export native C structure memory layout.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-02 09:56:57 +01:00
Huang Qi
b99a96a7d0 stream: Exchange name of lib_rawsostream.c and lib_rawoutstream.c
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-01 10:07:36 -03:00
Huang Qi
b96035885a stdio: Implement simple buffered out stream for vdprintf
Improve performance for raw fd based printf like operation.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-01 13:08:59 +09:00
Xiang Xiao
2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
yinshengkai
8d16fa04df libc/stream: Implement lowoutstream_puts
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-25 18:39:27 +08:00
chenrun1
4f3c73fb45 libc/lib_bzero:Add bzero prototype.
Implement the bzero function as an alternative to macro expansion.
2023-02-25 08:07:07 +02:00
lilei19
38f64f559d change strcpy to strlcpy
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +08:00
Xiang Xiao
68ff73c5fb stdio: lib_fgets convert \r\n to \n
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-24 10:39:48 +08:00
Xiang Xiao
cd74a1df22 libc/stdio: Make gets/gets_s work without CONFIG_FILE_STREAM
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-24 10:39:48 +08:00
chenrun1
5430de72f8 libc/lib_rawmemchr.c:Add rawmemchr methon. 2023-02-24 04:06:04 +08:00
Huang Qi
ca61c40453 stdio: Remove CONFIG_EOL_IS_XXX
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-24 00:35:19 +08:00
Xiang Xiao
8b4ecac6c2 libc: Move math library from libs/libc/math to libs/libm/libm
to prepare the support of other implementation e.g.:
https://github.com/JuliaMath/openlibm
https://gitlab.com/gtd-gmbh/libmcs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-23 10:40:07 +02:00
chao an
0f8ecc0150 libs/libc: export exit() if configured in flat mode
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-23 13:50:03 +08:00