Commit Graph

608 Commits

Author SHA1 Message Date
chao.an 05fdb2cf49 libs/libxx: use built-in __aeabi_atexit() if LIBSUPCXX is enabled
ld error caused by multiple definition:

ld: arm-none-eabi/lib/thumb/v8-m.main+fp/hard/libsupc++.a(atexit_arm.o): in function `__aeabi_atexit':
atexit_arm.cc:(.text.__aeabi_atexit+0x0): multiple definition of `__aeabi_atexit';
nuttx/staging/libxx.a(libxx_eabi_atexit.o):nuttx/libs/libxx/libxx_eabi_atexit.cxx:75: first defined here

Change-Id: If90419093de73b184a21f755c6ea7ba577d6665a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-13 21:03:06 +08:00
丁欣童 c1de1c563e Add placement new and new[] function.
N/A

Change-Id: I9f16f9c0c36f2619218a65d178100d54ced5f71b
Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
2021-01-13 17:51:58 +08:00
chao.an 999768e6f3 libc/machine/arch: fix build break if enable armv8 ELF
Change-Id: Icc213b5b5986c83b5a38f0ffd2e451ffa29386a2
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-12 00:10:33 +08:00
Xiang Xiao 085543a156 Move the declaration of nx_mkfifo/nx_pipe to nuttx/fs/fs.h
the new location is better than nuttx/drivers/drivers.h
since they are part of the file system api.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-08 11:16:03 +08:00
chao.an cf988ebad3 ctype/iscntrl: correct the control character function
all the characters placed before the space on the ASCII table
and the 0x7F character (DEL) are control characters.

Change-Id: Id187b39ce50b80e9ebee85a7242716eb017575d7
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-04 17:17:15 +08:00
danguanghua b71d5f0e84 bs/libc/net: implement socketpair (3)
N/A

Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=2&query=socketpair&manpath=FreeBSD+7.0-current&format=html

Change-Id: I2d09f5148b2a720d1e7f380503deb8910c951599
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2021-01-04 10:55:16 +08:00
danguanghua 0c0e24992d libs/libc/net: implement socketpair (2)
N/A

Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=2&query=socketpair&manpath=FreeBSD+7.0-current&format=html

Change-Id: I784615bcf6d19c0deb4dbe2b81067ec9f59314a1
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-31 18:31:40 +08:00
danguanghua d226e8fb49 libs/libc/net: implement socketpair
N/A

Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=2&query=socketpair&manpath=FreeBSD+7.0-current&format=html

Change-Id: I959b4d661cd436f5d5050baf9e821db84139d482
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-30 18:26:50 +08:00
chao.an 7b82ddd4a8 libc/dumpvbuffer: fix a bug that the iov ptr is not updated
Change-Id: I6060dd296eed14308893554d254715a7a9908655
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 16:03:15 +08:00
Xiang Xiao ca2ec9b137 libc: Add b64_ntop and b64_pton implementation
implemented by many libc(e.g. freebsd, glibc, newlib)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-29 11:22:13 +08:00
Xiang Xiao 8add509608 libc/netdb: Move hostbuffer out of the stack
The length of hostbuffer come from Kconfig, it isn't safe to
allocate this variable on the stack.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I75213688153a1cba738544de2a51fa3247626dd3
2020-12-22 21:44:25 +08:00
chao.an 39e9a0a498 libs/libc/dump: reduce the code size
Change-Id: I95562cbaec7ab4d9274658add1967da8bc97fcdb
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-22 17:38:40 +08:00
chao.an c9dcce4f30 Revert "libs/libc/dumpbuffer: add support to dump the buffer to file descriptor."
This reverts commit 080b380955.
2020-12-22 16:25:38 +08:00
chao.an 080b380955 libs/libc/dumpbuffer: add support to dump the buffer to file descriptor.
Change-Id: I5742a69a75faf288df36da12ee5138f27a4f1532
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-21 17:18:26 +08:00
chao.an 776a2ca8cc libs/libc: add lib_dumpvbuffer support
e.g: Encapsulation Type: Bluetooth H4: add packet type dump support

From:

lib_dumpvbuffer(NULL, data, len);

[    1.567100] 0000  03 0c 00                                         ...
[    1.890100] 0000  0e 04 01 03 0c 00                                ......
[    1.890100] 0000  03 10 00                                         ...
[    1.892900] 0000  0e 0c 01 03 10 00 ff ff 8f fe db ff 5b 87        ............[.
[    1.892900] 0000  01 10 00                                         ...
[    1.894900] 0000  0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22        ........"...."
[    1.894900] 0000  02 10 00                                         ...
[    1.901900] 0000  0e 44 01 02 10 00 ff ff ff 03 fe ff ff ff ff ff  .D..............
[    1.901900] 0010  ff ff f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61 f7  ......?.......a.
[    1.901900] 0020  ff ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[    1.901900] 0030  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[    1.901900] 0040  00 00 00 00 00 00                                ......

To:

struct iovec bufs[2];

bufs[0].iov_base = &type;
bufs[0].iov_len = 1;
bufs[1].iov_base = data;
bufs[1].iov_len = len;

lib_dumpvbuffer(NULL, bufs, 2);

[    3.711400] 0000  01 03 0c 00                                      ....
[    4.035400] 0000  04 0e 04 01 03 0c 00                             .......
[    4.035400] 0000  01 03 10 00                                      ....
[    4.037400] 0000  04 0e 0c 01 03 10 00 ff ff 8f fe db ff 5b 87     .............[.
[    4.037400] 0000  01 01 10 00                                      ....
[    4.039400] 0000  04 0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22     ........."...."
[    4.039400] 0000  01 02 10 00                                      ....
[    4.046400] 0000  04 0e 44 01 02 10 00 ff ff ff 03 fe ff ff ff ff  ..D.............
[    4.046400] 0010  ff ff ff f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61  .......?.......a
[    4.046400] 0020  f7 ff ff 7f 00 00 00 00 00 00 00 00 00 00 00 00  ................
[    4.046400] 0030  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[    4.046400] 0040  00 00 00 00 00 00 00                             .......

Change-Id: I51716014dedb6a3b9fb10ea84779f1d82487e9b0
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-21 17:17:48 +08:00
chao.an 0248643f80 libs/libc/dumpbuffer: remove the unnecessary printable characters traversal
Change-Id: I0114a7074ccf760d5e22ca643e1ad71e4c445fa0
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-21 16:00:05 +08:00
chao.an 07dc013b60 libs/libc/dumpbuffer: fix nxstyle warning
Change-Id: I0f397ea5b210d2c4325ef87afb880e98072414d6
2020-12-21 15:52:38 +08:00
chao.an f6c7e13f7f libs/libc/dumpbuffer: add support to recognizable from wireshark
e.g: Encapsulation Type: Bluetooth H4

From:

[    2.196000] 0000: 030c00                                                            ...
[    2.514600] 0000: 0e0401030c00                                                      ......
[    2.514600] 0000: 031000                                                            ...
[    2.517600] 0000: 0e0c01031000ffff8ffedbff5b87                                      ............[.
[    2.517600] 0000: 011000                                                            ...
[    2.520600] 0000: 0e0c0101100006bb22060a00bb22                                      ........"...."
[    2.520600] 0000: 021000                                                            ...
[    2.527600] 0000: 0e4401021000ffffff03feffffffffff fffff30fe8fe3ff783ff1c00000061f7 .D.............. ......?.......a.
[    2.527600] 0020: ffff7f00000000000000000000000000 00000000000000000000000000000000 ................ ................
[    2.527600] 0040: 000000000000                                                      ......

To:

[    1.567100] 0000  03 0c 00                                         ...
[    1.890100] 0000  0e 04 01 03 0c 00                                ......
[    1.890100] 0000  03 10 00                                         ...
[    1.892900] 0000  0e 0c 01 03 10 00 ff ff 8f fe db ff 5b 87        ............[.
[    1.892900] 0000  01 10 00                                         ...
[    1.894900] 0000  0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22        ........"...."
[    1.894900] 0000  02 10 00                                         ...
[    1.901900] 0000  0e 44 01 02 10 00 ff ff ff 03 fe ff ff ff ff ff  .D..............
[    1.901900] 0010  ff ff f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61 f7  ......?.......a.
[    1.901900] 0020  ff ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[    1.901900] 0030  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[    1.901900] 0040  00 00 00 00 00 00                                ......

Change-Id: I788df074679af510e020fe0937123129aa42b190
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-21 15:52:32 +08:00
Xiang Xiao 984defadd0 libc: Implement posix_fallocate
as specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/posix_fallocate.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-14 18:21:35 +08:00
chao.an 093e8b994f crypto/arc4random: rename getrandom to arc4random_buf
Change-Id: I5c9f0c9acf5af71f01beceaf06ebe0a2c87676bc
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-12 14:38:19 +08:00
chao.an a44376ad2d Revert "libs/libc: correct the getrandom(2) prototype"
This reverts commit 8411ef1873.

Signed-off-by: chao.an <anchao@xiaomi.com>
Change-Id: I29e90e01f3b8a0460ee53831d38d96edf7d12ef2
2020-12-12 12:13:42 +08:00
chao.an e0f23b0c02 libs/libc/net: implement etheraton/ether_aton_r
Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=3&query=ether_aton&manpath=FreeBSD+7.0-current&format=html

Change-Id: I3e70c985836600837dd61810ba290be59b6e8e6f
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-10 01:30:47 +08:00
chao.an 511d65392a libs/libc: correct the getrandom(2) prototype
Reference here:
https://man7.org/linux/man-pages/man2/getrandom.2.html

Change-Id: I25b913c4b6533b3888cb2b9c62bb71505a0815c9
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-07 14:44:25 +08:00
dongjiuzhu 93b3c7a34d unistd/getopt: remove count of arguments
N/A

For commands without "-" arguments, ex:"ls", we should always let
optind = 1 after getopt is called in order to get what follows
correctly.

Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
Change-Id: Iac3cfbadd27fb96e47070c4e3198229306299b6b
2020-12-01 11:20:54 +08:00
dongjiuzhu 4a0f96fd4f pthread_mutexattr_getprotocol: modify prototype
MIRTOS-116

modify the return value according to posix standard
Change-Id: I6e32a8f7a5cac85fe7a395a8115710fdff61d985
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-12-01 10:44:16 +08:00
Matias N 2860069883 build system: add missing --obj-path to MKDEP 2020-11-30 11:20:15 +08:00
chao.an 90dc86655c style/Makefile: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-30 11:20:05 +08:00
Xiang Xiao 463457b001 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-27 11:48:16 +08:00
Xiang Xiao b1d85d4978 libc/machine/arch: Support armv8-m relocation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-27 11:48:16 +08:00
Xiang Xiao b44b05c9b6 libs/libc/machine/arm: Rename armv8 to armv8-m
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-27 11:48:16 +08:00
Xiang Xiao d7014061b2 libc/machine/arm: Use the correct arch Kconfig for variant check
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-27 11:48:16 +08:00
Xiang Xiao b4887dfab1 libs/libc/machine: Remove ARCH_CORTEXM33 dependence from LIBM_ARCH_xxx
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-27 11:48:16 +08:00
liuhaitao 9218f09d38 Restore getopt in nuttx mainline instead
N/A

Do not use the special getopt patch and use getopt for nuttx
mainline instead.

Change-Id: I388944cd0a0cfaa64e251ad5565fd8eb8c4e609a
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-11-25 20:13:05 +08:00
liuhaitao c24f178af7 Merge remote-tracking branch 'mirtos/master' into dev
Change-Id: I85394b24ce27d20ecbb130b85d844ab540507031
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-11-25 14:44:27 +08:00
Alin Jerpelea 9f6a43d0b0 libs: audio: libsamplerate: drop local patches
The needed patches were accepted upstream and now there is no need to
carry local patches.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-11-24 10:54:57 -08:00
YAMAMOTO Takashi 5566d9ad03 libs/libc/netdb/lib_dnsquery.c: Fix a syslog format 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi c1f9d8adb1 libs/libc/machine/risc-v/rv64/arch_elf.c: Fix syslog formats 2020-11-22 19:01:05 -08:00
Matias N d5b6ec450f Parallelize depend file generation 2020-11-22 09:02:59 -03:00
YAMAMOTO Takashi 42a218dabb libs/libc/machine/arm/armv7-m/arch_elf.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi 04f2542cc2 libs/libc/machine/arm/armv7-m/arch_elf.c: Appease nxstyle
The following errors are intentionally left.
They are a part of tables which are not trivial to fix.

libs/libc/machine/arm/armv7-m/arch_elf.c:230:94: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:232:89: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:240:94: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:242:89: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:403:94: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:405:91: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:413:94: error: Long line found
libs/libc/machine/arm/armv7-m/arch_elf.c:415:91: error: Long line found
2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi 34cd44f8d7 libs/libc/modlib/modlib_symbols.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi 6bdca69a32 libs/libc/modlib/modlib_bind.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
Xiang Xiao 759b63d4be libc: implement getopt_long partially
only the short option is supported now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-21 07:01:08 -06:00
Xiang Xiao af53bdb048 libc: Add opterr global variable
defined here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-21 07:01:08 -06:00
YAMAMOTO Takashi 8a70c6bf47 libs/libnx/nxfonts/nxfonts_cache.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi 07a67c7b96 libs/libnx/nxmu/nx_eventhandler.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi aa653fef63 libs/libnx/nxglib/nxglib_splitline.c: Fix syslog formats
Note: b16_t is int32_t.
2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi 02b92c5ad9 libs/libc/pthread/pthread_attr_setstacksize.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi efe8e24fe7 libs/libnx/nxmu/nx_eventhandler.c: Appease nxstyle 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi 6d8ccccbb0 libs/libnx/nxglib/nxglib_splitline.c: Appease nxstyle 2020-11-20 22:22:53 -08:00