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>
| $ 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>
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.
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>
and Fix include/nuttx/mm/map.h:55:28: error: 'struct task_group_s' declared inside parameter list will not be visible outside of this definition or declaration
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
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>
- 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>
- 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>
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
In some cases, deleting a folder will return unexpected results. For example, ENOENT should be returned when deleting a non-existent folder, but the result will return ENOTDIR.
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>
It is enought to only checking the buflen's avaiable or not.
(total size means total copied size)
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
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>