if driver complete unlink ops, we need to call it to release some resource,
otherwise, it will only remove inode.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Change the type of task group member to single list chain to
avoid accessing the memory allocator to improve the performance
Signed-off-by: chao an <anchao@lixiang.com>
Pre-allocated files to avoid allocator access during thread creation
phase, For functional safety requirements, increase
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK could also avoid allocator access
caused by the file descriptor exceeding the limit.
For Task Termination, the time consumption will be reduced ~3us (Tricore TC397 300MHZ):
10.65(us) -> 7.35(us)
NOTE:
This commit will not waste of extra heap, just pre-allocates the list of files for task_group.
Signed-off-by: chao an <anchao@lixiang.com>
Use private naming to avoid conflicts with user applications
In file included from libuv/src/unix/internal.h:25,
from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
57 | #define container_of(ptr, type, member) \
|
In file included from nuttx/include/nuttx/list.h:47,
from nuttx/include/nuttx/tls.h:40,
from nuttx/include/nuttx/sched.h:48,
from nuttx/include/nuttx/arch.h:87,
from nuttx/include/nuttx/userspace.h:35,
from nuttx/include/nuttx/mm/mm.h:30,
from nuttx/include/nuttx/kmalloc.h:34,
from nuttx/include/nuttx/lib/lib.h:31,
from nuttx/include/stdio.h:35,
from apps/system/libuv/libuv/include/uv.h:59,
from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
48 | #define container_of(ptr, type, member) \
|
Signed-off-by: chao an <anchao@lixiang.com>
Currently at runtime it is hard to know the exact build config of
the current NuttX instance. Thus it is inconvenient when there are
multiple configs for the same board. This patch attempts to solve
the issue by adding build config to /proc/version.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
When we close a socket fd, it will call get path on sockets.
`close(socket_fd)` -> `file_closelk(filep)` -> `file_fcntl(F_GETPATH)`
It causes a heavy stack load for each socket close operation.
(We have `GETPATH` for sockets to be used for `fdinfo`)
But the socket fds are not intended to be used for file locks.
And so do some other file types, so we may just limit the usage of flock.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
These variables will trigger variable 'ret' set but not used warnings due to different configurations.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
When issuing an ioctl for a file that exists in a FAT32 file system,
the FAT ioctl() is first executed, but it returns -ENOSYS in
an attempt to pass through to the vfs.
Therefore, the ioctl of the VFS layer, which expects -ENOTTY,
is not processed and an error occurs.
Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
It seems that RPMSGFS is missed from the list that doesn't need block or
MTD drivers. This attempts to add it.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
The DIRSEC_BYTENDX(f, i) is supposed to have DIRSEC_NDXMASK(f) in its expansion instead of DIRSEC_NDXMASK(fs). It went unnoticed in the codebase as DIRSEC_BYTENDX(fs, idx) is the way it is used, and it leads to a similar expansion as desired, and thus it has worked till now without any issues from this.
Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
When shmfs_truncate is called, it uses shmfs_alloc_object to create the
physical backing for the shm file. However, the allocated physical
memory returned by mm_pgalloc is not cleared when CONFIG_BUILD_KERNEL is
set, which is a clear POSIX violation:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html
"If the file was previously shorter than length, its size is increased,
and the extended area appears as if it were zero-filled."
For FLAT and PROTECTED modes zalloc is used, so the violation affects
KERNEL mode only.
nuttx/driver/rpmsg: new folder, extract common rpmsg api in rptun.c to rpmsg.c.
rpmsg provide rpmsg_ops to each backend for specific implementation.
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
Fix the issue where fat driver is not using the last two clusters in
the file system.
The fat parameter fs->fs_nclusters is the maximum number of data clusters;
this doesn't include the two in the beginning. Many checks in the fat driver
treat the fs->fs_nclusters-1 as being the last accessible cluster, which is not
right, the last accessible one is actually this number + 2 when the cluster
count includes the two first ones.
Normally this is not an issue when writes are being done through the same
driver, the last two clusters are just never used. But if the filesystem is
modified by external driver, for example with a populated fat created with PC,
or modifying the FS via USB-MSC, this leads to the fat driver not being able to
read anything that uses the last two clusters.
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Usage:
1. CONFIG_FS_PROCFS_MAX_STACK_RECORD > 0, such as 32,
2. add '-finstrument-functions' to CFLAGS for What you want to check
stack.
3. mount porcfs
4. cat /proc/<pid>/stack will print backtace & size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
A segmentfault might happen when read/write/unlink ops called without an open
ops called because it bind ept's ops in rpmsgblk_open_handler.
proxy> rm /dev/ram1
segmentfault
proxy> ls /dev/ram1
segmentfault
Signed-off-by: liaoao <liaoao@xiaomi.com>