Commit Graph

2020 Commits

Author SHA1 Message Date
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
hujun5
8fe8417ffb libc/fdcheck: add fdcheck module
In embedded development environments, due to the lack of address isolation between processes,
fd may be passed between processes and lead to misuse,

We have designed an fd cross-process automatic detection tool,
fdcheck_protect returns the fd containing the pid information,
indicating that the ownership of the current fd belongs to the pid and is not allowed to be used by other processes.
fdcheck_restore will obtain the true fd and check if the ownership of the fd is legal

For ease of understanding, let's give an example where
the following information is represented in 32-bit binary format

fd        00000000 00000000 00000000 10001010
pid       00000000 00000000 00000011 01010101
ret       00000000 00000011 01010101 10001010

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-06-10 02:19:58 +08:00
hujun5
02628deb55 libc/fdsan: keep f_tag unchanged
When the file pointer is reopened, keep f_tag unchanged as fd remains unchanged
fix issue https://github.com/apache/nuttx/issues/9494

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-06-09 21:06:48 +08:00
anjiahao
7732791cd6 mempool:Add mail_info support for multiple pools
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-08 23:56:40 +08:00
chao an
fb9b41221d semantic/parser: fix compile warning found by sparse
Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-30 23:00:00 +08:00
Xiang Xiao
dde8ae468e fs/partition: register partition device if caller doesn't provide handler
to avoid the duplication of common logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-27 20:23:17 -03:00
Xiang Xiao
5528c84c03 fs/partition: MBR parser should initialize blocksize field
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-27 20:23:17 -03:00
Michal Lenc
5f5ffa9380 fix compile warnings caused by incorrect variable format in print
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-27 18:52:01 +08:00
liaoao
6ea3eb3ce2 procfs:add /proc/cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
Ville Juven
e0f4a76d6c fs_poll: Fix wrong return value in CONFIG_BUILD_KERNEL
The exit condition below does not work:

  if (ret < 0)
    {
      set_errno(-ret);
      return ERROR;
    }
  else
    {
      return count;
    }
2023-05-25 20:41:20 +08:00
anjiahao
c60dd72a2a Support memdump to realize incremental dump function
Add a new field to record the global on the basis of mm_backtrace.
When using alloc, the field is incremented by 1,
so that the memory usage can be dumped within the range
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-05-22 12:31:32 +08:00
Xiang Xiao
7990f90915 Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 09:52:08 -03:00
hujun5
90387a5b41 libc/misc: add fdsan module
FD (file descriptor) is widely used in system software development,
and almost all implementations of posix os (including nuttx) use FD as an index.
the value of fd needs to be allocated starting from the minimum available value of 3, and each process has a copy,
so the same fd value is very easy to reuse in the program.

In multi threaded or multi process environments without address isolation,
If the ownership, global variables, and competition relationships of fd are not properly handled,
there may be issues with fd duplication or accidental closure.
Further leading to the following issues, which are difficult to troubleshoot.

1. Security vulnerability: the fd we wrote is not the expected fd and will be accessed by hackers to obtain data
2. Program exceptions or crashes: write or read fd failures, and program logic errors
3. The structured file XML or database is damaged: the data format written to the database is not the expected format.

The implementation principle of fdsan is based on the implementation of Android
https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-17 10:24:42 +08:00
simbit18
ad957be5a9 fs/nxffs/Kconfig: Fix indentation
Remove spaces from Kconfig
2023-05-10 00:45:29 +08:00
Xiang Xiao
17f173d555 fs/vfs: Zero file struct field with memset
to avoid set fields to zero one by one

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 17:56:07 +03:00
Xiang Xiao
1955992ae5 fs: Replace strncat with strlcat
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
6f6fce95a2 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
fa8719bb5a Replace all strcat with strlcat
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
08ababd704 fs/vfs: Add a new argument(size_t len) to inode_getpath
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Radek Pesina
d58c445ac5 Add patch for littlefs to use kmm_malloc/free on kernel with MMU. 2023-04-28 16:45:05 +08:00
chao an
507c8145a9 sched/spawn: remove spawn proxy thread to simplify task/posix_spawn()
The spawn proxy thread is a special existence in NuttX, usually some developers
spend a lot of time on stack overflow of spawn proxy thread:

https://github.com/apache/nuttx/issues/9046
https://github.com/apache/nuttx/pull/9081

In order to avoid similar issues, this PR will remove spawn proxy thread to simplify
the process of task/posix_spawn().

1. Postpone the related processing of spawn file actions until after task_init()
2. Delete the temporary thread of spawn proxy and related global variables

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-27 17:35:58 +08:00
yinshengkai
006afeb21f fs/inode: when searching for nextname skip "/" and "./"
fix the problem that stat fails to use the relative path
An error will be reported if used in the following way:
stat("//./bin", &st);

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-04-25 21:28:59 +08:00
Xiang Xiao
dd631265c4 fs: Add g_ prefix for all global mountpt_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
Xiang Xiao
51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
yinshengkai
c418d147fe procfs: add total time running time of task
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-04-24 19:38:29 +08:00
anjiahao
49cd7a795a mm:change special pid to macro
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-04-23 23:28:32 +08:00
chao an
13cdffd302 fs/procfs: fix readdir loss last character
nsh> ls proc/fs
/proc/fs: ----> /proc/fs:
 block           blocks
 moun            mount
 usag            usage

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-23 17:13:51 +08:00
Xiang Xiao
4be499a243 procfs: Make g_procfs_entries in the alphabetic order
and option in procfs/Kconfig

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
c6d210289f procfs: remove procfs_ from procfs_operations variables
to aglin the naming style with other implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
149cafe450 procfs: Add g_ prefix to all procfs_operations
to conform the coding style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
404de093a1 fs: Flush the file system cache in BOARDIOC_POWEROFF too
and remove the check of SYS_DOWN since it defines to SYS_RESTART in reboot_notifer.h:
  #define SYS_DOWN        0x0001     /* Notify of system down */
  #define SYS_RESTART     SYS_DOWN
  #define SYS_HALT        0x0002     /* Notify of system halt */
  #define SYS_POWER_OFF   0x0003     /* Notify of system power off */

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-21 20:37:59 +03:00
Ville Juven
53d4b9ed54 mm/mm_map: Give the mm_map as parameter to the mm_map functions
This way the mappings can be modified for any vm area, not only the
process that is running.

Why? This allows mapping pages to kernel dynamically, this functionality
will be presented later.
2023-04-22 00:40:37 +08:00
Ville Juven
30bae2ca47 fs/cromfs: Fix faulty DEBUGASSERT() check
The logic being tested is wrong, obviously when accessing file the
driver private data has to be valid (open() has been called).
2023-04-21 10:29:08 -04:00
Fotis Panagiotopoulos
ab1b3c0337 Added missing checks in strdup'ed strings. 2023-04-19 02:49:31 +08:00
Fotis Panagiotopoulos
098b7bbfb3 Fixes in asprintf usage. 2023-04-19 02:48:39 +08:00
XinStellaris
770817ba2f fs/littlefs:littlefs shouldn't be used without C99 BOOL
Signed-off-by: XinStellaris <tianxin7@xiaomi.com>
2023-04-18 13:40:50 -04:00
zhangyuan21
c239d19df0 nuttx: add more dependent header file
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-04-11 09:13:32 +03:00
Xiang Xiao
3aab2a2e73 fs/nxffs: Fix typo(nxem_wait->nxmutex_lock) error in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-07 09:06:06 +03:00
Dong Heng
a51e102a41 xtensa/esp32: Make asprintf and lib_free corresponding 2023-04-06 20:57:19 +03:00
Gregory Nutt
717bb04cb7 Increase the number of real time signals. Two is not enough.
Refer to issue #8867 for details and rational.

Convert sigset_t to an array type so that more than 32 signals can be supported.

Why not use a uin64_t?
- Using a uin32_t is more flexible if we decide to increase the number of signals beyound 64.
- 64-bit accesses are not atomic, at least not on 32-bit ARMv7-M and similar
- Keeping the base type as uint32_t does not introduce additional overhead due to padding to achieve 64-bit alignment of uin64_t
- Some architectures still supported by NuttX do not support uin64_t
  types,

Increased the number of signals to 64. This matches Linux. This will support all xsignals defined by Linux and also 32 real time signals (also like Linux).

This is is a work in progress; a draft PR that you are encouraged to comment on.
2023-03-27 16:59:04 +03:00
chenrun1
01cfb3b2db fs/fs_initialize.c: Sync will only be executed when the add is in reboot state.
In the last change, the assert behavior test was not considered. Therefore, in this change, sync will be performed only when SYS_RESTART/SYS_DOWN situation occurs, avoiding unpredictable results caused by handling locks or semaphores in interrupts.
2023-03-25 11:43:37 +02:00
chenrun1
7485f1c81d fs/fs_initialize.c:Sync fs in system restart callback 2023-03-25 11:43:37 +02:00
wangbowen6
5d53c8299e fs/fs_epoll: add oneshot list to handle the EPOLLONESHOT correctly
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-03-23 09:43:27 +02:00
dongjiuzhu1
f8b27d9fbe fs/mmap: try rammap when filesystem mmap don't support
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-03-10 10:43:33 +02:00
Karel Kočí
62661600b2 treewide: add DOWNLOAD variable as unification of curl call
This is a followup to the commit
03b164f59c.
2023-03-08 17:05:05 +08:00
Xiang Xiao
2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
lilei19
38f64f559d change strcpy to strlcpy
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +08:00
Jiuzhu Dong
9340d6e0d7 fs/rpmsgfs: return ENOTTY to vfs to do cmd operate
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2023-02-23 21:42:45 +02:00
chao an
9c30d3bf33 procfs/meminfo: skip invalid character before memdump
In the case of echo characters, atoi will mistake CRLF as a digit character and convert it to 0

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-23 13:51:12 +08:00
chao an
e28958fe5c fs/mount: fix compiler warning found out by GCC-12.2
mount/fs_foreachmountpoint.c: In function 'mountpoint_filter':
mount/fs_foreachmountpoint.c:99:38: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
   99 |       sprintf(&dirpath[pathlen], "/%s", node->i_name);
      |                                      ^
In function 'mountpoint_filter',
    inlined from 'mountpoint_filter' at mount/fs_foreachmountpoint.c:64:12:
mount/fs_foreachmountpoint.c:99:7: note: 'sprintf' output between 2 and 257 bytes into a destination of size 256
   99 |       sprintf(&dirpath[pathlen], "/%s", node->i_name);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-21 09:28:57 +08:00
lilei19
77f6319268 sync ps/assert output 2023-02-17 23:35:44 +08:00
Ville Juven
905cba3ee3 group/tg_info/argv: Make utility function to read argv as string
This creates a generic and safe way to read a process argument vector
as string from any context.
2023-02-17 01:27:16 +08:00
Xiang Xiao
4009cb1970 fs: Don't guard ftruncate with CONFIG_DISABLE_MOUNTPOINT
since ftruncate depends on file_operations not mountpt_operations

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00
Xiang Xiao
a05f9aaa85 fs: Don't guard fsync with CONFIG_DISABLE_MOUNTPOINT
since the driver can also support fsync by implementing BIOC_FLUSH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00