Commit Graph

1163 Commits

Author SHA1 Message Date
Xiang Xiao
70290b6e38 arch: Change the linker generated symbols from uint32_t to uint8_t *
and remove the duplicated declaration

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-24 21:26:56 +02:00
chao an
a3a4e89efc libs/libc/arm: use builtin routines instead of aliases of __aeabi_mem*
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-24 00:10:36 +08:00
Xiang Xiao
8565882bb5 libc/stdio: Let STDIO_DISABLE_BUFFERING depends on FILE_STREAM
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 17:41:05 +02:00
Xiang Xiao
bdcd232c98 libc/netdb: Let LIBC_GAISTRERROR/NETDB_BUFSIZE/NETDB_MAX_IPADDR depends on LIBC_NETDB
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 17:41:05 +02:00
Xiang Xiao
4c44c6f709 arch.h: Make _sinit/_einit as an offical interface
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 08:29:24 +08:00
Xiang Xiao
a7bbd33f1b libc: Remove the reference of _stext/_etext from lib_cxx_initialize.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 08:29:24 +08:00
Xiang Xiao
9afb6540dc libc/ftok: Map token to the root pseduo file system directory
to ensure the generated key is unique from each other since only
root pseduo file system really support st_ino field after:
commit d35fbf534d51f7ef72382d9666a1f19e07c6f00f
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Fri Sep 16 14:24:55 2022 +0800

    fs: Allocate unique serial number for the root pseduo file system node

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:21:06 +08:00
Xiang Xiao
8df223a1ef libc: Add LIBC prefix to MEM_FD_VFS_PATH
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:21:06 +08:00
Xiang Xiao
9c229a0173 libc: Remove LIBC_ERR from libs/libc/misc/Kconfig
forget in https://github.com/apache/incubator-nuttx/pull/6805

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-16 22:56:38 +02:00
ligd
4a87578bdb wqueue: change single queue to double queue to improve speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-08 15:03:54 +02:00
ligd
2cc3ec57ef queue: add dq_rmafter support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-08 15:03:54 +02:00
Neale Ferguson
213b954a90 * Squash round() commits
- Add check in roundx() functions for infinite or NaN cases
  - Add block to avoid style warnings
  - Define long double constants and macros for infinity and nan
  - Correct return syntax to match NuttX style
  - Make c89 compliant
  - Fix definitions of INFINITY_L/NAN_L

* include/nuttx/lib/math.h - match standard naming conventions
  - Rename isinf_l to isinfl
  - Rename isinf_f to isinff
  - Add finite()
  - Add finitel()
  - Add finitef()
  - Define isnanl and isnanf
  - Define isfinite() so that it uses the appropriate macro

* libs/libc/math/lib_asinf.c
  libs/libc/math/lib_asinl.c
  libs/libc/math/lib_roundf.c
  libs/libc/math/lib_roundl.c
  libs/libc/math/lib_sqrtf.c
  libs/libc/math/lib_sqrtl.c
  - Use renamed macros
  - Use correct NAN_x or INFINIT_x macro on returns
2022-09-08 20:57:27 +08:00
wangbowen6
4e1097280a telink: add custom setjmp implementation for tlsr82.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-08 09:15:25 +08:00
anjiahao
1a5351edac libc:add timingsafe_bcmp to libc
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-09-05 22:27:05 +08:00
Juha Niskanen
fb852440af pthread: fix typo with CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_INHERIT
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2022-09-05 15:36:23 +02:00
Junbo Zheng
74ab851ac4 nuttx/libs/libc/time: fix runtime error by UBSan
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2022-09-05 14:55:25 +08:00
zhangyuan21
1a9252aec9 nuttx/queue: change some queue function to macro 2022-09-04 11:08:02 +08:00
Fotis Panagiotopoulos
985710665a Fixed pow() for negative bases. 2022-09-03 21:19:10 +08:00
Huang Qi
28872ca3ed libc: Fix wrong report from UBSan
```
ubsan_prologue: ================================================================================
ubsan_prologue: UBSAN: array-index-out-of-bounds in symtab/symtab_allsyms.c:62:37
__ubsan_handle_out_of_bounds: index 1619 is out of range for type 'symtab_s [1]'
ubsan_epilogue: ================================================================================
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-30 19:35:24 +08:00
Nathan Hartman
a0ee5d3747 libc: Port strtod fixes to strtof, strtold and improve comments
* libs/libc/stdlib/lib_strtod.c:
  (strtod): Add a note about limitations of this implementation
   as compared to POSIX in the function's docstring. Also fix a
   typo.

* libs/libc/stdlib/lib_strtof.c:
  (strtof): Port the changes made to strtod in PR-6952 (commit
   c83985c5ce) and add same note as above to docstring.

* libs/libc/stdlib/lib_strtold.c:
  (strtold): Same changes as strtof.
2022-08-30 09:47:50 +08:00
Fotis Panagiotopoulos
c83985c5ce Fixes in strtod parser. 2022-08-29 17:13:11 -03:00
Huang Qi
e0185faa78 Don't download tarballs if a local git repo found
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-28 03:07:58 +08:00
Huang Qi
e4e3208180 Replace all strncpy with strlcpy for safety
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-25 13:38:36 +08:00
chengkai
4ee39f6e9a libc: add lib_dump utils
Signed-off-by: chengkai <chengkai@xiaomi.com>
2022-08-24 16:58:10 +08:00
chao.an
0e6edd39ec libs: fix visual studio Compiler Error C2124
D:\code\incubator-nuttx\libs\libc\stdlib\lib_strtof.c(76,1): error C2124: divide or mod by zero

Windows MSVC restrictions, MSVC doesn't allow division through a
zero literal, but allows it through non-const variable set to zero

Reference:
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2124?view=msvc-170

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-24 16:50:48 +08:00
chao.an
62977ec4e8 arch/sim: add windows host simulate support
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-23 22:04:42 +08:00
Alan Carvalho de Assis
cf6eabd125 libc.csv: Add new found missing functions 2022-08-17 11:23:56 +08:00
Alan Carvalho de Assis
607ef3426a Add some missing functions to libc.csv 2022-08-16 10:04:51 +08:00
zhanghongyu
daf39c03bd dns_client: directly initialize g_dns_servers and remove dns_initialize directly
g_dns_servers need init before dns_query, Otherwise sim can not add default
dns server when use usrsock mode to share host network.

Avoid similar problems in the future, so directly initialize g_dns_servers.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-08-15 16:39:37 +03:00
Xiang Xiao
2b37909c9e libc: Move crc8.h, crc16.h and crc32.h from include to include/nuttx
to avoid the conflict with the 3rd party library

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-13 13:28:24 +03:00
Xiang Xiao
fa2e1897ea libc: Implement memfd on top of tmpfs
https://man7.org/linux/man-pages/man2/memfd_create.2.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-09 22:13:09 +03:00
Jiuzhu Dong
4dbf4555eb fs/dir: support fchdir and dirfd
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong
3a70962b7a fs/directory: use file mode to manage directory
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Xiang Xiao
e26d8759d0 libc: Remove CONFIG_LIBC_ERR
let linker remove the unused object files from the final image

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-08 07:39:59 -04:00
Peter van der Perk
f64677b8c9 Add Embedded Template Library (ETL) support 2022-08-05 09:38:48 +08:00
Nathan Hartman
20bdd44e7b Remove executable permission from source and build files. 2022-08-04 12:48:18 -03:00
liyi25
1141ee28e9 delay creating DNS bind socket
Signed-off-by: liyi <liyi25@xiaomi.com>
2022-08-03 23:43:48 +08:00
Peter van der Perk
013a562478 Net thread-safe ntoa functions
Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-08-02 21:04:19 +08:00
chao.an
ca24efff80 libs/libc: correct config name
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-07-27 20:18:05 +08:00
Xiang Xiao
0f7da4fd75 libc: Remove the unnecessary include from wchar and wctype
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-27 10:55:37 +03:00
Jiuzhu Dong
673a2e0136 libc/wchar: support wchar
Implemented according to https://en.wikipedia.org/wiki/UTF-8

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-27 00:36:49 +08:00
Jiuzhu Dong
035840a770 libc/wchar: remove unnecessary config
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-27 00:36:49 +08:00
Masayuki Ishikawa
2ce12617a1 libs: spawn: Add forkaround for posix_spawn_file_actions_adddup2()
Summary:
- I noticed that adb shell failed when sh is spawned.
- Finally, I found that an error happened when executing dup2() action
  if the file descriptor has the O_CLOEXEC option.
- This commit fixes this issue by dropping the option in the API.

Impact:
- posix_spawn_file_actions_adddup2() only

Testing:
- adbd with sabre-6quad:netnsh (will be merged later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-07-26 16:04:21 +08:00
Karel Kočí
6c7f99189b libs/libc/string: add memmem
This function is the GNU extension.
2022-07-22 19:04:11 +03:00
Xiang Xiao
4e92e32d7b libc/impure: Fix the inconsistence from the different toolchain
some toolchain provider remove const qualifier from global_impure_ptr
(e.g. Espressif) but other provider keep it(e.g. ARM or Cadence), so
let's define const to empty macro to pass the compile and more safety.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-22 11:02:48 +03:00
ligd
3db8c2b6a6 stdio: need also flush stdio when flushall
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 01:46:21 +03:00
Xiang Xiao
1d43b4a4eb libc/stdio: Enable LIBC_FLOATINGPOINT by default if ARCH_FPU is enabled
and DEFAULT_SMALL is false

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-21 09:53:09 -04:00
Xiang Xiao
63cb11cc72 libc/stdio: Support "long long" type if CONFIG_HAVE_LONG_LONG is enabled
but just format the low 32bits if CONFIG_LIBC_LONG_LONG isn't enabled to
avoid to expand the code space to much.
Note: the size will increase 192 bytes on stm32_tiny:nsh.
Before the change:
   text    data     bss     dec     hex filename
  41444     184    1656   43284    a914 nuttx
After the change:
   text    data     bss     dec     hex filename
  41636     184    1656   43476    a9d4 nuttx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-20 18:06:29 +03:00
Xiang Xiao
f9e3ef3464 Revert "libc/stdio: enable long long formating by CONFIG_HAVE_LONG_LONG"
This reverts commit b1c72c023c.
2022-07-20 18:06:29 +03:00
Xiang Xiao
2166c98809 Add printflike and scanflike to all printf/scanf like functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-18 14:14:36 +03:00