- Adjusted the link count for directories to ensure it starts at 2, accounting for the self-reference and parent directory link.
- Updated the logic for incrementing and decrementing link counts when creating and deleting directories.
- Enhanced the dynamic calculation of directory link counts in the VFS layer to ensure accuracy when metadata is unreliable.
This change improves the consistency of link count management across different filesystem implementations.
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(filesystem): 新增preadv2系统调用支持
- 实现preadv2系统调用,支持带偏移量和标志位的向量化读取
- 处理offset为-1时使用当前文件偏移量,其他情况复用preadv逻辑
- 添加RWF标志位验证,遵循Linux兼容性要求
Signed-off-by: longjin <longjin@DragonOS.org>
* refactor(open): remove follow_symlink parameter from do_sys_open and related functions
- Simplified the do_sys_open and do_open functions by removing the follow_symlink parameter.
- Updated all calls to these functions to reflect the change, ensuring that symlink following behavior is determined by the O_NOFOLLOW flag in the file flags.
- Enhanced code readability and maintainability by streamlining function signatures.
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
- Add rt_sigqueueinfo and rt_tgsigqueueinfo system calls for POSIX-compliant signal delivery
- Enhance kill process functionality with proper signal validation and permission checks
- Improve process exit handling with signal cleanup and parent notification
- Update fork implementation to handle signal inheritance properly
- Implement setresuid system call with proper privilege management
- Add comprehensive test coverage for signal-related syscalls
Signed-off-by: longjin <longjin@DragonOS.org>
- Add sched_getparam syscall to retrieve process scheduling parameters
- Add sched_getscheduler syscall to get process scheduling policy
- Refactor sched_yield into separate module with proper syscall handler
- Add utility functions for scheduling permission checks
- Remove old do_sched_yield implementation from main syscall module
Signed-off-by: longjin <longjin@DragonOS.org>
- Introduced a new module for managing kernel log levels, mimicking Linux behavior.
- Added support for dynamic log level configuration via command line and procfs interface.
- Created a new `/proc/sys/kernel/printk` file for reading and writing log level settings.
- Updated existing logging mechanisms to utilize the new log level management system.
- Enhanced the QEMU startup script to allow setting log levels through environment variables.
This implementation improves logging flexibility and aligns with expected Linux functionality.
Signed-off-by: longjin <longjin@DragonOS.org>
- Add proper error handling for concurrent namespace file creation
- Move namespace type validation earlier in the creation process
- Ensure child inodes are fully initialized before being visible in children map
- Handle EEXIST race condition by re-checking children map
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(procfs): Add support for /proc/thread-self/ns namespace files
- Introduced a new module for handling namespace files under /proc/thread-self/ns, allowing applications to reference namespaces via symlinks.
- Implemented dynamic creation of namespace files and their corresponding IDs, ensuring compatibility with Linux behavior.
- Updated ProcFS to create necessary directory structures and files for thread-specific namespaces.
- Enhanced existing ProcFileType enum to include new types for thread self namespaces.
This addition improves the process namespace management and aligns with expected Linux functionality.
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(namespace): Implement setns syscall for namespace management
- Added the `setns` syscall to allow processes to join existing namespaces using a file descriptor.
- Implemented kernel-level logic to handle namespace switching based on provided flags, supporting pidfd and namespace fd types.
- Enhanced the namespace management by integrating with the existing `NsProxy` structure, ensuring compatibility with Linux behavior.
- Updated related modules and added necessary error handling for invalid flags and file descriptors.
This addition improves the flexibility of namespace management in the kernel, aligning with expected Linux functionality.
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(vfs): Implement mount propagation mechanism in VFS
- Added support for mount propagation types: Shared, Private, Slave, and Unbindable.
- Introduced a new module for managing mount propagation semantics, including peer group registration and event propagation.
- Updated existing mount functions to handle propagation logic during mount and unmount operations.
- Enhanced documentation to include details on the new mount propagation features and their usage.
- Added unit tests to verify the correctness of mount propagation behavior across different scenarios.
This implementation aligns with Linux semantics for mount propagation, ensuring compatibility and expected behavior in containerized environments.;
Signed-off-by: longjin <longjin@DragonOS.org>
* refactor(filesystem): optimize mount propagation and logging
- Replace ID allocator with atomic counter for propagation groups
- Refactor peer group registry into structured class with better APIs
- Remove verbose debug logs to reduce noise
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(namespace): correct mount propagation peer group handling
- Fix peer group registration when changing propagation type from shared
- Ensure propagated mounts join source child's peer group instead of target
parent's group
- Add proper peer group cleanup when transitioning from shared propagation
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(vfs): implement recursive bind mount support
- Add recursive bind mount functionality with MS_BIND | MS_REC flags
- Implement BFS traversal for copying submounts in do_recursive_bind_mount
- Fix mount registration order to prevent dangling registrations on failure
- Add comprehensive test cases for recursive and non-recursive bind mounts
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>