Zhe Weng
d563717827
fs/romfs: Fix FIOC_FILEPATH for dup'ed file
...
The FIOC_FILEPATH ioctl needs rf->rf_path, which is not initialized for
dup'ed romfs file and cause problems.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-02 06:12:25 -07:00
Fotis Panagiotopoulos
0fcf6f2e41
open: Use file mode only when O_CREAT is specified.
2023-08-02 06:08:20 -07:00
hujun5
0b2b5b781c
fs: remove sched_[un]lock
...
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-08-01 23:15:37 +02:00
dongjiuzhu1
f8ce0cd4ca
fs/pseudofile: config pseudofile feature
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 22:22:58 -07:00
dongjiuzhu1
8336ee78b8
vfs/fs_pseudofile: fix coverity issue
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 22:22:58 -07:00
dongjiuzhu1
0f6d0eac52
fs/pesudofile: support pseudo-file operation
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 22:22:58 -07:00
dongjiuzhu1
80004ef07d
fs/nfs: fix coding style issue
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 21:41:30 -07:00
yangyalei
f2844a2e3c
vfs: return OK when fsync dir
...
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
wangbowen6
b0ab41beee
memdump: support dump the leak memory (malloced but task exit)
...
1. command "memdump leak" can dump the leacked memory node;
2. fix the leak memory stat bug in memory manager;
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-07-31 05:48:33 -07:00
dongjiuzhu1
e4c015f0aa
fs/nfs: support seek, fsync operation
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 03:46:13 -07:00
Xiang Xiao
427e574bd1
fs/unionfs: Remove unionfs_mount function
...
since the same function can be achieved by mount:
mount(NULL, "/mnt/unionfs", "unionfs", 0,
"fspath1=/mnt/path1,prefix1=prefix1,"
"fspath2=/mnt/path2,prefix2=prefix2");
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-30 18:51:26 -03:00
wangjianyu3
0a52dfaa66
TXTABLE: Support backup table
...
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2023-07-29 20:27:10 -07:00
wangjianyu3
ca08f069a7
partition: Add TXTABLE parser
...
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2023-07-29 20:27:10 -07:00
fangxinyong
dfa6a43744
fs/mmap: fix wrong return value check
...
while iterate throuh all mapping memory to munmap and release,
the last entry is NUlL.
We need differentiate the case with invald entry at the first.
The fix is to pass ltp shm related cases.
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-07-28 08:05:39 -07:00
dongjiuzhu1
88161bfca5
fs/mmap: add sanity check
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 08:05:39 -07:00
dongjiuzhu1
e4739ab575
fs/tmpfs: add munmap interface for tmpfs file map
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 08:05:39 -07:00
dongjiuzhu1
f8991f7782
vfs/dup: add nonblock flag to avoid happening block when dup
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 07:41:51 -07:00
yangjiao
c2e1aa281d
fs/semaphore/sem_open: update the logic when the semaphore name length is greater than PATH_MAX or a component length is greater than NAME_MAX.
...
Follow the POSIX specification in https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html , update the logic for condition that the semaphore name length is greater than PATH_MAX or a component length is greater than NAME_MAX.
Signed-off-by: yangjiao <yangjiao@xiaomi.com>
2023-07-28 07:38:41 -07:00
dongjiuzhu1
1cc67b68f2
fs/procfs: call the close of each component when procfs_close
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 05:09:07 -07:00
Xiang Xiao
f3269a6caa
sched: Rename DEBUG_TCBINFO to ARCH_HAVE_TCBINFO
...
and select if the arch support to define g_tcbinfo variable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-26 09:33:38 +02:00
chao an
49dec5b48c
cmake/build: fix build break on cmake
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-25 15:00:10 +02:00
anjiahao
9f644579b3
fix sim register & tcb info typo
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-23 21:59:35 -07:00
Xiang Xiao
abfe082a6f
Kconfig: Simplify the conditional default statement
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
Xiang Xiao
e031a73aef
Kconfig: Change some "default y" to "default !DEFAULT_SMALL"
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
chao an
f10b54a081
cmake: fix CMake build break
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
dulibo1
13c7138c8d
add refcnt using epoll_create to fix bug when use popen which dup the fd and close at end after epoll_create
...
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-07-13 01:06:53 +08:00
simbit18
9681c52517
Fix nuttx coding style
...
Remove TABs
Fix indentation
2023-07-11 23:32:17 +08:00
yanghuatao
e9d7210d02
sim/posix_test: fix shm_open() return file descriptor associated with FD_CLOEXEC
...
Make the pthread_setspecific pass the shm_open/11-1.c testcases. Function shm_open() should return a file descriptor for the shared memory object associated with FD_CLOEXEC. Reference to https://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html and https://github.com/lattera/glibc/blob/master/sysdeps/posix/shm_open.c#LL38C1-L38C1
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-07-11 13:30:34 +08:00
chao an
6ee9ec7656
build: add initial cmake build system
...
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)
------------------
How to test
From within nuttx/. Configure:
cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja
(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja
This uses ninja generator (install with sudo apt install ninja-build). To build:
$ cmake --build build
menuconfig:
$ cmake --build build -t menuconfig
--------------------------
2. cmake/build: reformat the cmake style by cmake-format
https://github.com/cheshirekow/cmake_format
$ pip install cmakelang
$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done
Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Xiang Xiao
935f43185f
libc/modlib: Replace nx_stat with file_stat
...
to avoid searching the path twice
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:20:24 -03:00
Junbo Zheng
7c8adecca8
fs/mount: correct df -h
output format
...
config: ./tools/configure.sh sim:nsh
correct before
```
nsh> df
Block Number
Size Blocks Used Available Mounted on
0 0 0 0 /bin
64 8 8 0 /etc
0 0 0 0 /proc
512 985 2 983 /tmp
nsh>
nsh> df -h
Filesystem Size Used Available Mounted on
binfs 0B 0B 0B /bin
romfs 512B 512B 0B /etc
procfs 0B 0B 0B /proc
vfat 492K 1K 491K /tmp
nsh>
```
correct after
```
nsh> df
Block Number
Size Blocks Used Available Mounted on
0 0 0 0 /bin
64 8 8 0 /etc
0 0 0 0 /proc
512 985 2 983 /tmp
nsh> df -h
Filesystem Size Used Available Mounted on
binfs 0B 0B 0B /bin
romfs 512B 512B 0B /etc
procfs 0B 0B 0B /proc
vfat 492K 1K 491K /tmp
nsh>
```
config: ./tools/configure.sh ../vendor/sim/boards/miwear/configs/miwear -j16
correct before
```
nsh>
nsh> df
Block Number
Size Blocks Used Available Mounted on
0 0 0 0 /bin
4096 240075962 87644775 152431187 /data
64 3621 3621 0 /etc
4096 240075962 87644775 152431187 /font
4096 240075962 87644775 152431187 /i18n
0 0 0 0 /proc
4096 240075962 87644775 152431187 /resource/app
4096 240075962 87644775 152431187 /resource/misc
4096 240075962 87644775 152431187 /resource/recovery
4096 240075962 87644775 152431187 /resource/system
4096 240075962 87644775 152431187 /system
512 26 24 2 /tmp
4096 240075962 87644775 152431187 /vendor
4096 240075962 87644775 152431187 /watchface
nsh>
nsh> df -h
Filesystem Size Used Available Mounted on
binfs 0B 0B 0B /bin
hostfs 915G 334G 581G /data
romfs 226K 226K 0B /etc
hostfs 915G 334G 581G /font
hostfs 915G 334G 581G /i18n
procfs 0B 0B 0B /proc
hostfs 915G 334G 581G /resource/app
hostfs 915G 334G 581G /resource/misc
hostfs 915G 334G 581G /resource/recovery
hostfs 915G 334G 581G /resource/system
hostfs 915G 334G 581G /system
tmpfs 13K 12K 1K /tmp
hostfs 915G 334G 581G /vendor
hostfs 915G 334G 581G /watchface
```
correct after
```
nsh>
nsh> date
Mon, Jul 03 02:09:53 2023
nsh>
nsh> df
Block Number
Size Blocks Used Available Mounted on
0 0 0 0 /bin
4096 240075962 87644776 152431186 /data
64 3621 3621 0 /etc
4096 240075962 87644776 152431186 /font
4096 240075962 87644776 152431186 /i18n
0 0 0 0 /proc
4096 240075962 87644776 152431186 /resource/app
4096 240075962 87644776 152431186 /resource/misc
4096 240075962 87644776 152431186 /resource/recovery
4096 240075962 87644776 152431186 /resource/system
4096 240075962 87644776 152431186 /system
512 26 24 2 /tmp
4096 240075962 87644776 152431186 /vendor
4096 240075962 87644776 152431186 /watchface
nsh>
nsh> df -h
Filesystem Size Used Available Mounted on
binfs 0B 0B 0B /bin
hostfs 915G 334G 581G /data
romfs 226K 226K 0B /etc
hostfs 915G 334G 581G /font
hostfs 915G 334G 581G /i18n
procfs 0B 0B 0B /proc
hostfs 915G 334G 581G /resource/app
hostfs 915G 334G 581G /resource/misc
hostfs 915G 334G 581G /resource/recovery
hostfs 915G 334G 581G /resource/system
hostfs 915G 334G 581G /system
tmpfs 13K 12K 1K /tmp
hostfs 915G 334G 581G /vendor
hostfs 915G 334G 581G /watchface
nsh>
```
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2023-07-03 23:09:46 +03:00
Petro Karashchenko
b1dd5d1189
drivers/wireles/gs2200m: add NET_TCP dependency to NFS_DONT_BIND_TCP_SOCKET option
...
The NFS_DONT_BIND_TCP_SOCKET should be selected only TCP networking is enabled
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-03 13:32:31 +08:00
Masayuki Ishikawa
c2af551355
fs: nfs: Introduce CONFIG_NFS_DONT_BIND_TCP_SOCKET
...
Summary:
- Some network drivers such as GS2200M do not support to bind
a local port for TCP client socket. In this case, this config
disables to bind the port.
- See also https://github.com/apache/nuttx/pull/3707
Impact:
- None
Testing:
- Tested with spresense:wifi_smp (Kconfig will be updated later)
- Tested with sabre-6quad:netnsh_smp (QEMU)
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-07-01 13:18:27 +08:00
Masayuki Ishikawa
221d919b77
Revert "fs: nfs: Do not bind to a local port in TCP mode"
...
This reverts commit e1b14271c8
.
2023-07-01 13:18:27 +08:00
guoshichao
1466a9e2b6
libs/libc/aio: refactor the fd flags check procedure
...
1. make the implementation compatible with c89
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-30 20:23:09 -03:00
guoshichao
d5f45dc33b
libs/libc/aio: fix aio_cancel compatible issue
...
1. make the aio_cancel implementation can pass the
ltp/open_posix_testsuite/aio_cancel testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_cancel.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 23:25:33 +08:00
guoshichao
d4dc0f6ec7
libs/libc/aio: fix aio_fsync compatible issue
...
1. make the aio_fsync implementation can pass the
ltp/open_posix_testsuite/aio_fsync testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_fsync.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 18:15:48 +08:00
guoshichao
dc69b108b8
libs/libc/aio: fix aio_write compatible bug
...
1. make the aio_write implementation can pass the
lpt/open_posix_testsuite/aio_write testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_write.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 00:59:27 +08:00
Mingjie Shen
7d13f5eb78
fs/fat: Fix undefined behavior in signed integer overflow check
...
Testing for overflow by adding a value to a variable to see if it "wraps
around" works only for unsigned integer values, because signed overflow
has undefined behavior according to the C and C++ standards.
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-28 23:02:25 +08:00
Xiang Xiao
987b01221c
fs/rpmsgfs: Zero dirs after realloc to avoid stale data
...
since many places assume the null pointer as an unused entry
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-28 10:29:21 -03:00
guoshichao
d33f90b78c
libs/libc/aio: fix aio_read compatible bug
...
1. make the aio_read implementation can pass the
ltp/open_posix_testsuite/aio_read testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_read.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-28 10:28:28 -03:00
Fotis Panagiotopoulos
880d78f903
sendfile: Fixed behavior of sendfile when count is set to zero.
...
If sendfile() is called with a zero count, it will nevertheless
try to send the data. This is mostly meaningless, it causes
waste of resources, and in some cases delays.
This commit adds special handling for this case, allowing
sendfile to return immediately zero. The new behavior is
in line with the Linux variant of sendfile.
2023-06-22 16:10:58 +08:00
Xiang Xiao
a8e0a5faa4
sched: Remove the unnecessary cast from pid_t to int
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-19 11:37:34 +03:00
Xiang Xiao
f01deff80f
mm: Rename MM_BACKTRACE_XXX_PID to PID_MM_XXX
...
and move the definition to malloc.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 09:12:14 +03:00
Xiang Xiao
ddbe9eb6ab
mm: Rename mm_memdump_s to malltask
...
align with the naming of mallinfo_task
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 09:12:14 +03:00
wangbowen6
940bbfc720
rpmsg: support the fdsan feature for rpmsg dev/mtd/blk
...
Directly return -ENOTTY in rpmsgxxx_ioctl() when the command is
not supported to avoid fdsan command FIOC_SETTAG and FIOC_GETTAG
pass to the rpmsg dev/mtd/blk server with CONFIG_FDSAN enabled.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:34:39 +08:00
wangbowen6
7117d3ea8a
fs_fsync: should not call fs's ioctl when fs not support sync api
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:31:17 +08:00
wangbowen6
279667a8f5
fs_romfs: avoid the romfs ERROR log when enable FDSAN
...
Error log:
[ 0.003400] [remote] romfs_ioctl: ERROR: Invalid cmd: 783
[ 0.003400] [remote] romfs_ioctl: ERROR: Invalid cmd: 782
[ 0.003500] [remote] romfs_ioctl: ERROR: Invalid cmd: 783
[ 0.003600] [remote] romfs_ioctl: ERROR: Invalid cmd: 782
[ 0.042900] [remote] romfs_ioctl: ERROR: Invalid cmd: 783
[ 0.043100] [remote] romfs_ioctl: ERROR: Invalid cmd: 782
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:31:17 +08:00
zhanghongyu
b723e90356
fs: move memset to upper lever for statfs
...
if struct statfs add new members, such as f_fsid, no additional code
changes are required.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-06-16 11:10:25 +08:00
zhangyuan21
c71007323e
fs/vfs: Proper use of sigisemptyset
...
Use sigandset function instead of & operation,
because the sigset_t structure has been changed.
This PR is to adapt to the changes made in #8885 .
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-06-15 10:11:36 -03:00