Fotis Panagiotopoulos
098b7bbfb3
Fixes in asprintf usage.
2023-04-19 02:48:39 +08:00
Dong Heng
a51e102a41
xtensa/esp32: Make asprintf and lib_free corresponding
2023-04-06 20:57:19 +03: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
lilei19
38f64f559d
change strcpy to strlcpy
...
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +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
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
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
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
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
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
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
qinwei1
c137aeec32
fs/vfs: add missed truncate/mmap callback at timerfd file_operation
...
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2023-01-06 13:31:38 +08:00
Xiang Xiao
b0a0ba3ad7
fs: Move mmap callback before truncate in [file|mountpt]_operations
...
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Xiang Xiao
779a610ca3
Remove the unnecessary NULL fields in global instance definition of file_operations
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Jukka Laitinen
f33dc4df3f
Change FIOC_MMAP into file operation call
...
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen
41e9df2f3e
Add ftruncate into file operation calls
...
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen
36528eed64
Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"
...
This reverts commit dbc163f1b0
.
2023-01-02 11:23:20 -03:00
dongjiuzhu1
f85d9a9332
fs/signalfd: using file descriptor to accept signal
...
Reference here:
https://man7.org/linux/man-pages/man2/signalfd.2.html
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 23:05:58 +08:00
dongjiuzhu1
d36b7fea45
timerfd: remove timeout work and do notify in isr
...
1.Optimize notification speed
2.using enter/leave critical to replace spin_lock to avoid race condition
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 22:45:25 +08:00
dongjiuzhu1
c7eca3d176
timerfd/eventfd: using file_allocate to replace register_driver
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 22:45:25 +08:00
Ville Juven
2ed51d026c
fs/streams: Move the file streams from the group structure into TLS
...
This is preparation for flushing streams from user space, like it should
be done.
- Move tg_streamlist (group, kernel space) ->
ta_streamlist (TLS, user space)
- Access stream list via tg_info in kernel
- Access stream list via TLS in user space
- Remove / rename nxsched_get_streams -> lib_getstreams
- Remove system call for nxsched_get_streams
2022-12-22 20:16:11 +08:00
qinwei1
a4f06660d2
fs_epoll: fix some potential issue for list operation
...
VELAPLATFO-4690
Summary
1. delete item before free it
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
Change-Id: Ie101a0cdba97caa8c3bbf0830dc0a35750688a41
2022-12-13 21:00:11 +02:00
dongjiuzhu1
b1b2a7cc0b
timerfd_create: initial reference count to zero
...
nx_open in timerfd_create will increase reference count,
Therefore, the reference count starts with a value of 0.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-01 15:07:09 +08:00
wangbowen6
a0ded9d0d4
fs_epoll: [bug fix] epoll node use-after-free in epoll extend list
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-26 11:56:58 +08:00
wangbowen6
2f2176151e
fs_epoll: [bug fix] EPOLL_CTL_ADD/MOD consider the teardown list too
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-25 21:34:09 +08:00
wangbowen6
25bfd437fe
fs_epoll: support extend the epoll dynamicly.
...
1. epoll_ctl(EPOLL_CTL_ADD) support extend the epoll
events dynamicly;
2. enhance the epoll performance by moving some poll setup
and teardown process to the EPOLL_CTL_ADD/DEL/MOD;
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-22 21:08:56 +08:00
zhangyuan21
f27065cb9e
sched/mqueue: make mqueue and mqueue sysv can disable separately
2022-11-16 20:03:40 +08:00
Xiang Xiao
b72be1ddbf
epoll: Call poll_notify before unlock mutex
...
to avoid the race condition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-11 21:12:59 +01:00
Xiang Xiao
7e8e5c10d1
fs/epoll: Reuse fd returned from epoll for internal signaling
...
to avoid the usage of nuttx special extension(POLLFILE)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-11 21:12:59 +01:00
Xiang Xiao
faf16fb810
vfs/epoll: Protect epoll_ctl by mutex
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 22:06:46 +01:00
Xiang Xiao
7231a5f044
vfs/epoll: Replace sem_t with mutex_t for locking usage
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 22:06:46 +01:00
anjiahao
d7b4e91dda
Call nxsem_destroy or nxmutex_destry in the error path
...
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 13:56:52 +01:00
Xiang Xiao
604eea453b
fs/vfs: Let caller control whether add the reference count of inode in file_allocate
...
to simplify the caller in some special case
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao
4af98af376
fs/vfs: Rename files_allocate to file_allocate
...
align with the intention better
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao
fc1efe2c0b
fs: Remove the unused nx_fcntl to prefer file_fcntl for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
b22cc1e2b8
fs: Remove the unused nx_dup to prefer file_dup for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
cf21319d3a
fs: Remove the unused nx_poll to prefer file_poll for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
aa31648c9f
fs: Remove the unused nx_[v]ioctl to prefer file_[v]ioctl for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
ab12bea1ae
Fix vfs/fs_timerfd.c:73:17: error: duplicate member 'lock'
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-23 12:08:30 +08:00
Miguel Herranz
819ebe7356
libc/stdio: Add stdio file locking functions
...
Add flockfile(), ftrylockfile() and funlockfile() functions [1].
[1] POSIX.1-2008 / System Interfaces / flockfile
https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/flockfile.html
Signed-off-by: Miguel Herranz <miguel@midokura.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-22 23:34:45 +08:00
anjiahao
5724c6b2e4
sem:remove sem default protocl
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
chao an
205c8934a3
sched/msgq: add support of System V message queue
...
https://man.openbsd.org/msgget.2
Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-22 12:58:11 +08:00
YAMAMOTO Takashi
4eee9af668
file_vopen: Retry as a directory in case of EISDIR
...
This allows you to open() a directory without O_DIRECTORY.
2022-10-19 21:20:35 +08:00
YAMAMOTO Takashi
aa67e0a0f4
inode_stat: handle INODE_IS_PSEUDODIR case
...
If you open() a directory and fstat() it, you come here.
This commit fixes the file type in that case.
2022-10-19 21:20:35 +08:00
anjiahao
d1d46335df
Replace nxsem API when used as a lock with nxmutex API
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Xiang Xiao
47b47e0bb7
fs/vfs: Remove the redundancy file name comparison in mountptrename
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:27:08 -03:00