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
Igor Mišić
3a7382e690
fs/littlefs: add full support for LittleFS block device cfg in Kconfig
2023-02-13 18:46:46 +08:00
chao an
77f68b121b
fs/epoll: fix visual studio Compiler Error C2059
...
D:\archer\code\nuttx\fs\vfs\fs_epoll.c(456,15): error C2059: syntax error : '{'
Compiler error C2059:
The token caused a syntax error.
Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2059?view=msvc-170
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:11:55 +08:00
chao an
3a0fdb019d
nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
dongjiuzhu1
63e6f80fb0
sync: add sync api
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 12:15:05 +02:00
dongjiuzhu1
7bbabc74fb
fs/dir: provide absolute directory path for F_GETPATH by fcntl
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 03:45:38 +08:00
Stuart Ianna
a2a542562f
fs: Implment link as a normal function instead macro
...
so "using ::link;" can pass the compiling. This change also
simplify the implementation of the hard link in the future.
2023-02-04 18:31:23 -03:00
Xiang Xiao
09841300b0
Remove the remain MIN/MAX like macro
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-03 20:42:57 +08:00
fangxiang
2c8c35431d
fs/procfs: fix the issue of /proc/cpuload in SMP
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-02-02 22:48:30 +08:00
chao an
4c8d244fae
sched/getpid: replace syscall getpid/tid/ppid() to kernel version
...
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
Xiang Xiao
d92dc45a80
vfs: Suppoprt F_DUPFD_CLOEXEC and MSG_CMSG_CLOEXEC
...
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
https://linux.die.net/man/2/recvmsg
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-02 01:00:10 +02:00
Gustavo Henrique Nihei
e6b204f438
nuttx: Use MIN/MAX definitions from "sys/param.h"
...
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
Masayuki Ishikawa
e6884b8cb1
fs: mqueue: Fix file_mq_open() for SMP
...
Summary:
- I noticed that sometimes mqueue_test in ostest failed
(i.e. mq_open failed) with rv-virt:smp.
- This commit fixes this issue by replacing sched_lock with
critical section.
Impact:
- file_mq_open()
Testing:
- Tested with ostest on QEMU-7.1
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-02-01 15:00:47 +08:00
Xiang Xiao
3904fd775a
sched: Remove the unused TCB_FLAG_SCHED_OTHER
...
after https://github.com/apache/nuttx/pull/8330
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 16:16:25 +02:00
chao an
2ffe564fa2
fs/procfs: sort level0 process id
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-30 14:57:43 +08:00
dongjiuzhu1
e02a5a70eb
fs/partiton: add sanity check
...
mmcsd_spi don't support ioctl
when blocksize is zero, will cause crash.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-29 17:30:51 -03:00
Xiang Xiao
7d66a16c53
Minor style clean up
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 19:53:20 +02:00
zhangyuan21
8c52633bd0
fs: unlock tmpfs before free the file object
...
tcb will hold an invalid semaphore when CONFIG_PRIORITY_INHERITANCE is enabled
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-28 19:35:45 +08:00
Petro Karashchenko
2c972bd402
fs/shm: update pointer arithmetic logic
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:26:09 +08:00
Petro Karashchenko
d35d8b4a12
fs/shm: use ERROR instead of -1
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:26:09 +08:00
Alan Carvalho de Assis
c3a34a5956
fs: Avoid accessing filep fields if it is NULL & add DEBUGASSERTs
2023-01-20 22:31:00 +08:00
Xiang Xiao
f8d33e40ac
Fix mmap/fs_mmap.c:259:13: warning: 'mapped' may be used uninitialized in this function [-Wmaybe-uninitialized]
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-18 08:40:33 +01:00
Jukka Laitinen
a0ebddaac1
fs/shm: Add initial implementation for posix shared memory
...
This implements the file system logic for posix shared memory:
shm_open, shm_unlink, mmap, munmap and close
For flat and protected builds the memory simply allocated from (user) heap
For kernel build the memory is allocated from page pool and mapped with MMU
This doesn't yet support protection flags or re-sizing already truncated shared
memory area.
Co-authored-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-18 11:01:20 +08:00
chao an
3d7629a02c
fs/mmap: fix compile warning if set the optimize level to O3
...
| $ gcc -c "-O3" -Wall -isystem include -D__NuttX__ -D__KERNEL__ -I fs -I sched fs/mmap/fs_mmap.c -o fs_mmap.o
| include/sys/mman.h: In function ‘mmap’:
| fs/mmap/fs_mmap.c:259:13: warning: ‘mapped’ may be used uninitialized in this function [-Wmaybe-uninitialized]
| 259 | FAR void *mapped;
| | ^~~~~~
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-17 21:56:37 +08:00
Xiang Xiao
0a95c7721b
vfs/poll: Remove POLLFILE and POLLSOCK NuttX specific extension
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-17 14:02:59 +08:00
Xiang Xiao
b1899ffbfd
fs: Support O_NOFOLLOW flag
...
https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/open.html :
O_NOFOLLOW
If path names a symbolic link, fail and set errno to [ELOOP].
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-17 12:02:48 +08:00
Xuxingliang
9166eeddf6
fs/mmap: update mapped var before exit
...
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-01-17 11:12:26 +08:00
Xuxingliang
dce315005a
fs/mmap: rammap should return buffer start address
...
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-01-17 11:12:26 +08:00
crafcat7
047f7f8d3a
vfs/fs_truncate.c:Add socket judgment to return correct errno.
2023-01-17 10:29:41 +08:00
Jukka Laitinen
6db295481b
fs/mmap/fs_rammap.c: Remove void * arithmetic
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 23:08:58 +08:00
Jukka Laitinen
3577d2f055
fs/mmap/fs_anonmap.c: Remove void * arithmetic
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 23:08:58 +08:00
Petro Karashchenko
6c5cb98e7d
fs/mount: fix logging macro in FS automount
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-13 12:18:36 +08:00
Xiang Xiao
fd0195b0d8
fs/mmap: Suppor the partial unmap for anonymous mapping
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 19:11:56 +02:00
Xiang Xiao
fcd4a421e3
fs/mmap: Support the no backing file for anonymous mapping
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 19:11:56 +02:00
Xiang Xiao
ab67d6a75b
fs/mmap: Remove the duplication rammap handling
...
and minor ifx for style and format
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 19:11:56 +02:00
Ville Juven
416e83d57e
fs/poll: add missing FAR qualifier to poll()
...
Follow-up to #8072
2023-01-11 21:12:17 +08:00
Ville Juven
f730cf8ad8
fs/poll: Fix poll_notify for CONFIG_BUILD_KERNEL
...
With flat addressing the user pollfd list is given directly to the
drivers that perform the notification. This is fine when the addressing
is flat, as there is no ambiguity on who gets notified and the fds memory
is always mapped.
For kernel mode with MMU this does not work. The notification must be done
via a temporary buffer allocated from kernel memory.
Thus, create a copy of the user fds and pass the copy to the drivers.
Afterwards copy the output events back to the user.
2023-01-11 01:53:13 +08:00
Jukka Laitinen
b8f23fc3f7
Move rammaps to use mm_map list
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
Jukka Laitinen
a5ed8014e8
Move anonymous mapping emulation into own module under fs/mmap
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
Jukka Laitinen
dd97900221
fs/mmap: Add mappings to mm_map list if CONFIG_MM_MAP is defined
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
wangbowen6
a491d07061
sem_unlink: return ENOENT when the named semaphore does not exist.
...
Follow posix, return ENOENT when the named semaphore does not
exist to fix the ltp open posix sem_unlink 4-1.c test problem.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-01-09 22:46:30 +08:00
Xiang Xiao
9aa835815f
fs/timerfd: Reverse truncate and mmap field
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-07 14:27:42 +02:00