Commit Graph

39392 Commits

Author SHA1 Message Date
ligd 0a7d86f587 fs: remove INODE_IS_SPECIAL() use others instead
Change-Id: I949f1ad012836e6cb233d5362fe2542732b5ecf4
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-02 21:14:21 +08:00
ligd f58ef1476c fs/vfs: add nx_unlink support
Change-Id: If9009cb7301bb4e49bdce3aea2d56c243256f5a2
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-02 21:14:21 +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 a418dc5dc3 arch/sim: enable nxlooper
N/A

Change-Id: Ib8b98e90fa05b035e88dea000818f0f745af6b10
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-31 16:47:09 +08:00
chao.an 330253101c sim/hcitty: add hcitty adapter
Change-Id: I5abacce7aced5f394f8b1efe83190840bed0b03e
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-30 19:53:35 +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 688911373d arch/spinlock: implement the default test-and-set semantics
use the default testset implement on single core platform
that does not support test-and-set, more flexibility for
SMP drivers(using spinlock) if configured in a single-core
configuration.

Change-Id: I954899f71bc6e903dce48c6e27719cb99f13e4b6
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-30 15:20:33 +08:00
chao.an b19dfdb69c arch/sim/hci: reuse the reserved fields of hci buffer
Reuse the reserved fields of hci buffer to avoid redundant packet type splitting

Change-Id: I79d70ae939111bb909a6e0981c50e401734590f2
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 22:01:30 +08:00
Brennan Ashton 40392bd437 Bluetooth: Fix bt_buff lifecycle
Change-Id: I529aedae2507a9297c1d2d793451e4373c98092b
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 21:39:30 +08:00
chao.an b7100ed99a net/rpmsg: correct the lifecycle of sendlock
Change-Id: Ie23ee4c0052cf2fc66972ea9bc5f11c070fbcf8a
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 18:45:57 +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
chao.an 701da97575 sim/host/hcisocket: add avail/close interface
Change-Id: I3d96f62c4c3c7d703bfec74952953bee4aef9c7c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-28 11:25:02 +08:00
Xiang Xiao d2572b31d1 sched: Add include/sys/poll.h
since many libc implementation(e.g. glibc, freebsd) provide this header file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-25 17:43:05 +08:00
dongjiuzhu b9a62d9531 signal: fix compile break in c++
N/A

nuttx.rel: In function `__metal_sleep_usec':
nuttx/include/metal/system/nuttx/sleep.h:27: undefined reference to `nxsig_usleep(unsigned int)'
collect2: error: ld returned 1 exit status

Change-Id: I9dd2ed0a72d144bb152dc3753e7f9a6695dfb2d4
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-12-25 11:27:46 +08:00
dongjiuzhu e1975139a3 rpmsg_uart: fix compile break when enable rptun
N/A

nuttx.rel: In function `rpmsg_serialinit':
nuttx/arch/sim/src/sim/up_rptun.c:257: undefined reference to `uart_rpmsg_init'
collect2: error: ld returned 1 exit status
Makefile:310: recipe for target 'nuttx' failed

Change-Id: I93a20941bc07f749165dc8f012da46ddb7b02b00
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-12-25 11:27:31 +08:00
chao.an ac988a8d5e sim/names: add writev/readv into name list
Change-Id: Id0f6f24acd06dbd6a47c137caf4bfb5e3d097d31
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-24 18:03:57 +08:00
zhongan ae82517934 drivers/serial/uart_16550.c: fix complie warning.
N/A

Change-Id: I2c72d49734e7b3a534845ca3cddfe723f9789ba8
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-12-24 17:16:35 +08:00
chao.an 6991e6b89c fs/epoll: add asynchronous epoll control support
Change-Id: I2b8dbe51bebad9af08feb325430c838308f1912b
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-24 15:28:58 +08:00
chao.an 5af67beedb fs/epoll: add sanity check to handle invalid control option
Change-Id: I59ca6ef3b3a02165f0ed19d09099213dc27f2953
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-23 12:47:34 +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
Xiang Xiao 66b601e075 libc: Implement getppid
as specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/getppid.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-21 17:44:50 +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 f8d4a19a4a sched/signal: Make the pre-allocated irq actions configurable
the action can't be dynamically allocated in any irq handler
so it's important to let the user extend the number as needed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id30c5d93003e63514c24f2ca0df2f634c4c63c5f
2020-12-21 10:48:37 +08:00
Xiang Xiao 25dd031233 sched/mqueue: Make the pre-allocated irq messages configurable
the message can't be dynamically allocated in any irq handler
so it's important to let the user extend the number as needed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia26584c3815bac6cf24de4c88be0844ac8e8fba2
2020-12-21 10:48:30 +08:00
danguanghua 57d6d2fb49 audio: uninitialize usermq to NULL when the device has not
N/A

be opened anymore. There is no need to update usermq to NULL
in audio_open.

Change-Id: I0c20bfa40a4fcd5c8cae0cf09bb55e113435ea62
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-18 10:55:16 +08:00
chao.an 70213704ec arch/netdev: try tcp timer in every txavail call
In the current implementation, the first transmission of the new
connection handshake is depends entirely by tcp_timer(), which will
caused 0.5s - 1s delay each time in connect().

This patch is mainly to improve the performance of TCP handshake and wavehand.

Change-Id: Ic965a9fa26895f0d8e70368558f5bfbafdea7f58
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-15 21:41:29 +08:00
chao.an be88bb00ca net/tcp/handshake: send the SYN immediately.
Change-Id: I761cff3b9950b75327fa03fb53b861ea088d8b35
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-15 21:41:29 +08:00
chao.an ede54cad35 net/tcp: send the ack on nonblock mode
Change-Id: Ib5b74a97393c3fed4cc00c3678d738c1cb27ce1a
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-15 21:41:10 +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 36d912e80e fs/unionfs: remove excessive protection to avoid deadlock
Deadlock during recursive access if unionfs overlays procfs,
check the critical segment only and remove the useless protection part.

|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
...
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026

original call stack:
(gdb) bt
|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
|#1  0x08071629 in mountpoint_filter (node=0xf3df4540, dirpath=0xf3df4a28 "/proc", arg=0xf3de2fc4) at mount/fs_foreachmountpoint.c:119
|#2  0x0807171b in foreach_inodelevel (node=0xf3df4540, info=0xf3df4a20) at inode/fs_foreachinode.c:90
|#3  0x08071898 in foreach_inode (handler=0x8071530 <mountpoint_filter>, arg=0xf3de2fc4) at inode/fs_foreachinode.c:193
|#4  0x080716c1 in foreach_mountpoint (handler=0x8070e2f <blocks_entry>, arg=0xf3de300c) at mount/fs_foreachmountpoint.c:169
|#5  0x08071399 in mount_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at mount/fs_procfs_mount.c:537
|#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026
|#8  0x080657a2 in file_read (filep=0xf3de219c, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:110
|#9  0x0806581a in nx_read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:175
|#10 0x08065847 in read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:206
|#11 0x0805a242 in nsh_catfile (vtbl=0xf3df3f10, cmd=0xf3df4378 "df", filepath=0x808d5ed "/proc/fs/blocks") at nsh_fsutils.c:116
|#12 0x0805b1de in cmd_df (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_mntcmds.c:73
|#13 0x08056370 in nsh_command (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_command.c:1061
|#14 0x08053b16 in nsh_execute (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0, redirfile=0x0, oflags=0) at nsh_parse.c:741
|#15 0x08055998 in nsh_parse_command (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2578
|#16 0x08055a7b in nsh_parse (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2662
|#17 0x0805d691 in nsh_session (pstate=0xf3df3f10, login=1 '\001', argc=1, argv=0xf3de34b0) at nsh_session.c:191
|#18 0x0805b542 in nsh_consolemain (argc=1, argv=0xf3de34b0) at nsh_consolemain.c:115
|#19 0x0805346c in nsh_main (argc=1, argv=0xf3de34b0) at nsh_main.c:168
|#20 0x0805075a in nxtask_startup (entrypt=0x805340a <nsh_main>, argc=1, argv=0xf3de34b0) at sched/task_startup.c:165
|#21 0x08049713 in nxtask_start () at task/task_start.c:144
|#22 0x00000000 in ?? ()

Change-Id: Ic4c7aff0ea50388a371c525745e817a787dabcca
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-14 15:16:15 +08:00
chao.an 3f6ebaa76c syscall/csv: sort lines of syscalls
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-12 14:48:29 +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
Juha Niskanen f10bf64b18 crypto/random_pool.c: fix getrandom() when thread calling it gets canceled
Change-Id: I8f008beea52cd6dfa494af424b3c4ceb474e45a6
2020-12-12 12:55:35 +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
ligd 9ac98f21dc net/rpmsgsocket: fix connect timeout when remote not ready
force connect to block mode

Change-Id: I458f806411c93def0e64596f8e1c1680c485b298
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-12-11 15:01:59 +08:00
liuhaitao 211176f930 sim/mirtos: replace mirtos configs symlink to vendor/sim/configs
N/A

So to make nuttx git history more clean.

Change-Id: Id9acb38b43f4e4586b53cb91319b3e7a14599511
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-12-11 10:23:53 +08:00
pengyiqiang a8f81baa5d sim/mirtos: enable watchx
N/A

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Change-Id: I7516287eff6d610ef5a667cef5e275370d061473
2020-12-11 00:00:20 +08:00
ligd 4c7124ae6c socket_rpmsg: correct return values when type is DGRAM
Change-Id: I299686769616894e919eaa7a5727494aed92a302
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-12-10 16:39:03 +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
danguanghua 450b846cab fix build break with CONFIG_AUDIO_MULTI_SESSION enabled
N/A

Change-Id: Idfa87031e09f26bd4ca57b5c220ce0ca849f80c4
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-09 10:37:11 +08:00
chao.an a9cdcf2f7a sched/clock: independent the CLOCK_BOOTTIME
The previous commit will cause build break if the definition of clock
id is used in the switch case.

Change-Id: Iecd078818d28879883dd582b236372ba43171b13
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-08 11:47:51 +08:00
chao.an 8411ef1873 libs/libc: correct the getrandom(2) prototype
Reference here:
https://man7.org/linux/man-pages/man2/getrandom.2.html
https://www.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&manpath=freebsd-release-ports

Change-Id: I9813a46ad80db1436524a1fc44be40e4bf17105c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-08 11:28:31 +08:00
chao.an 098efd4949 sim/libusb: add fluoride libusb dependance
Change-Id: I4a99f65c2af67c64adb2f501a02a467b88ab9588
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-07 15:03:22 +08:00