Commit Graph

362 Commits

Author SHA1 Message Date
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
Xiang Xiao 7b19a605a7 fs/vfs: Free subdir before allocate new one in pseudorename
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:27:08 -03:00
Petro Karashchenko 969a06331f fs/vfs: fix case when file to rename does not exist
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-15 04:04:12 +08:00
Xiang Xiao 523da07778 fs/epoll: Notify POLLIN directly(avoid set POLLFILE)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-04 20:59:59 +02:00
Xiang Xiao e99c76a313 poll: Don't need monitor POLLERR or POLLHUP explicitly
since spec require the implementation always report POLLERR/POLLHUP:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-04 20:59:59 +02:00
wangbowen6 e9ccab2db3 fs/poll: using callback mechanism to implement poll notification
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-10-03 00:00:56 +08:00
Xiang Xiao bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
wangbowen6 5e46a9908a vfs/fs_poll: not clear POLLIN event if POLLHUP or POLLERR set
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-27 08:24:33 +09:00
wangbowen6 344c8be049 poll: add poll_notify() api and call it in all drivers
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-26 12:06:32 +08:00
Xiang Xiao db518bf0df fs: Allocate unique serial number for the root pseduo file system node
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:21:06 +08:00
Xiang Xiao 493152a45f fs/eventfd: Remove the extra space
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:20:17 +09:00
Nathan Hartman 09a186727c fs/vfs/fs_open.c: Improve documentation blocks of functions 2022-09-08 09:01:36 +08:00
Xiang Xiao 9726be616a fs: Run the default action of FIONBIO/FIOCLEX/FIONCLEX in success path
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-06 23:16:15 +08:00
Jiuzhu Dong 4dbf4555eb fs/dir: support fchdir and dirfd
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong fe17f747a7 fs/directory: move private directory information to filesystem
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 90db4daca9 fs/directory: update readdir interface for all filesystem
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 3a70962b7a fs/directory: use file mode to manage directory
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
ligd 5f68aa56fd poll: defalut set POLLERR POLLHUP to events
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:55 +08:00
Jiuzhu Dong 978530f5f6 fs/ioctl: add BLKSSZGET cmd to get block sector size
refer to:
https://sites.uclouvain.be/SystInfo/usr/include/sys/mount.h.html

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-22 09:07:57 +03:00
Jiuzhu Dong b385c48a30 fs/fs_fsync: add file sync operation by ioctl
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-22 09:07:57 +03:00
ligd cda9cfbc80 unlink: don't do unlink with inode_semtake
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 11:00:26 +08:00
Nathan Hartman 849f760b77 Fix various typos 2022-07-08 02:15:54 +08:00
Xiang Xiao 22e4f1c59a sched: Remove start from nxsem_tickwait[_uninterruptible]
to simplify both caller and callee

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-15 13:55:58 +03:00
Xiang Xiao f14eed6432 vfs/fcntl: Minor style fix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-14 17:21:25 +03:00
liuhaitao 05cc6fb610 fs/fcntl: add O_APPEND flag judge in fcntl
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2022-04-14 17:21:25 +03:00
Jukka Laitinen dbc163f1b0 fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-04-13 09:40:18 +08:00
yinshengkai 4b6743591a fs/vfs: fix st_mode mask check
The full mask for st_mode is 0177777
Now modify any file permissions in hostfs and all will fail
2022-04-08 15:06:41 +03:00