Commit Graph

39414 Commits

Author SHA1 Message Date
ligd dcf8dae046 mqueue: simplify the mqueue reailize
1. remove descript management in mqueue, save code size
2. use i_ops instead of i_mqueue to remove the dup logic

Change-Id: Ie88960e50ddcae9c87977c9ad65a45297c663291
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-08 14:31:37 +08:00
Xiang Xiao 0af4d1e617 fs: Remove the special hack for pty in nx_vopen
let's replace the content of file in place instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I538910d55815c7aec656c05dba4eab2fa1d6d964
2021-01-08 11:17:57 +08:00
Xiang Xiao 028c6aa6e6 fs: Add file_pipe function
so pty don't need call nx_pipe and then file_detach

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ibb8d108abd76bafe53897e5fca35babcf3e1bae9
2021-01-08 11:16:15 +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
Xiang Xiao 3eb62b010b fs: Fix the race condition in file_dup
NULL inode passed to files_allocate doesn't mark file struct in the
allocated state, so other threads which invovle in file allocation
(e.g. open or dup) may allocate the same file struct again.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53ff876eae3c7a1e311e7f671686b73a4b4ef891
2021-01-08 11:15:49 +08:00
Xiang Xiao 0112909453 fs: file_dup2 shouldn't destroy filep2 before the duplication of filep1 succeed
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I10956f5e32cc0add414076465c06a24a858e52bc
2021-01-08 11:14:51 +08:00
chao.an d3ffbe5367 netpacket/if_addr: add interface address header
Change-Id: I1aab82fea6916e187d19a66e4d0817119a98c3ea
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-08 10:25:19 +08:00
ligd 365df8d188 net/rpmsg/rpmsg_sockif.c: fix compile error in socketrpmsg
Change-Id: Ibbc62826317e204c49c744d1fb125da7b54eb7a3
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-07 14:17:03 +08:00
ligd 91de680de8 net/rpmsg/rpmsg_sockif.c: fix temporary sendsize is 0 bug
Change-Id: I4348fab159eda7e015340ea8067ff7866105bdd5
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-07 11:09:51 +08:00
liuhaitao 04c78a5d42 Add buildinfo.sh used to generate build info
MIRTOS-327

buildinfo.sh could be called to auto-generate necessary build
info including version and release etc information into ram.prop
loaded by kvdb service.

Change-Id: Iaec687639bc3e5e8b227762513382bab5c611eb6
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-06 15:50:50 +08:00
Xu Xingliang b49648663a Added miwear defconfig
N/A

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Change-Id: Iaa61b28116db9898f5ba3d027553d4e4786b3516
2021-01-06 10:44:31 +08:00
liuhaitao bbf409cc76 configure.sh: fix '/configure.sh -e board:config menuconfig' build break
MIRTOS-307

If boardconfig changed, '/configure.sh -e board:config menuconfig'
would finally call 'make distclean menuconfig' which results in
build break. It also applies to nconfig and qconfig.

Change-Id: I44c06718cbda948932c667b9f2d1339913c9ba37
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-05 11:00:10 +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
chao.an 37b90df314 sim/hcitty: fix compile warning
Change-Id: I74f89e179daacaa01ba95cc211574c1bbadd2f9e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-04 17:08:25 +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
Xiang Xiao 22b67c8cd4 fs: Move file_close from fs/inode/fs_fileclose.c to fs/vfs/fs_close.c
just like other vfs public functions

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id833da690f88013095fbbe1ea425227f808a5608
2021-01-04 10:50:01 +08:00
Xiang Xiao 0523f75202 fs: Remove _files_close and reuse file_close
to save the code space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I08455010ba121a61b0e29334b580aa83e69a9418
2021-01-04 10:50:01 +08:00
Xiang Xiao 3a0a438d29 fs: Let files_allocate return -EMFILE instead ERROR
since the internal function normally return the error code directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifccbcfb07d2f8f7d5fef1b2a867538f51b73655c
2021-01-04 10:50:00 +08:00
Xiang Xiao 79bd6b4c3f fs: Ensure fs_dupfd2 always return fd2 in the sucessful path
it's wrong to return file_dup2 directly since file_dup2 never return file handle

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I943537849c75d83b3d646a6a22f035187d9fd521
2021-01-04 10:50:00 +08:00
Xiang Xiao 351bbad39a fs: Remove inode null check from file_dup and fs_dupfd2
since the same check already done in file_dup2

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7ba1309c55be1ac564f798df02fc6725c4a0d469
2021-01-04 10:50:00 +08:00
ligd 6cc8b30aaf serial: fix build break caused by previous patch
serial/serial_dma.c: In function 'uart_check_signo':
serial/serial_dma.c:82:18: error: 'SIGINT' undeclared (first use in this function)
   82 |           return SIGINT;
      |                  ^~~~~~

This is canused by:
remove #include <nuttx/mqueue.h> from include/nuttx/fs/fs.h in:
d1ede9ac904d331ee6b22343f5d7f0ead7a113a6

Change-Id: I20260ad3bcceb30207c9c12041dd95de41e13777
2021-01-02 21:14:21 +08:00
Brennan Ashton ca0fb5694f vfs: Fix unsed label warning
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2021-01-02 21:14:21 +08:00
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