Created by: Alic3r3L1cwhk
This pull request implements the core of process inter-process communication (IPC) in StellarOS, including a full futex (fast userspace mutex) subsystem and System V shared memory (shm). It introduces new modules, updates documentation to reflect the expanded system call set (now 53), and describes the new robust futex list support for correct lock cleanup on thread exit. The futex implementation includes all major operations and robust list handling, while the shared memory module is integrated under the new ipc module.
Major new features:
Futex subsystem and robust list support:
- Added a complete futex subsystem (
os/src/futex/), supporting FUTEX_WAIT, FUTEX_WAKE, FUTEX_WAKE_BITSET, FUTEX_REQUEUE, and FUTEX_CMP_REQUEUE operations, with 256 hash buckets for wait queues and Jenkins hash for keying. This includes robust list support for automatic lock cleanup on thread exit. [1] [2] [3] [4] [5] - Integrated futex and robust list modules into the kernel source tree and updated the kernel directory structure in documentation.
System V shared memory (IPC):
- Added a new
ipcmodule with System V shared memory support (shmget,shmat,shmdt,shmctl), and re-exported the core syscalls and mapping structure.
Documentation and system call updates:
Documentation and syscall tracking:
- Updated the project
README.mdto mark phase 12 (IPC: shm/futex/clone) as complete, describe the newly supported syscalls and kernel modules, and increase the syscall count from 43 to 53. [1] [2] - Expanded the documented kernel directory structure to include the new
futex/andipc/modules. This pull request introduces a major refactor and extension of the networking subsystem, adding a full-featured loopback interface, trait-based socket abstraction, a unified event system for I/O multiplexing, and a global port manager. It also updates documentation to reflect the new architecture and system call capabilities. The changes significantly improve modularity, maintainability, and standards compliance for network features.
Networking Subsystem Refactor and Feature Enhancements:
- Added a loopback interface (
lo) alongside the existingeth0interface, both sharing the sameSOCKET_SET. Introduced dual-interface polling and automatic routing for TCP connections based on destination address. Provided a newget_iface_info()API for querying interface information and awith_iface_context_for()helper for context-aware socket operations. [1] [2] [3] [4] [5] [6] [7] [8] - Introduced a unified
Sockettrait (detailed in documentation), enabling polymorphic handling of sockets, and created aPollEventbitflags type for standardized I/O event reporting across all multiplexing syscalls. - Implemented a global
PortManagerto allocate and track TCP/UDP ports, ensuring no conflicts and proper ephemeral port assignment.
Raw Socket and Event Handling Improvements:
- Updated the raw socket implementation to support the new
PollEventsystem, added a method to check non-blocking mode, and provided apoll()method for event readiness. [1] [2] [3]
Documentation and Metadata Updates:
- Updated
README.mdand project structure documentation to reflect the addition of the loopback interface, the new system call (accept4), the total syscall count, and the new network architecture. Clarified future work and current capabilities. [1] [2] [3] [4] [5] - Removed the now-obsolete
LOOPBACK_ADDRconstant fromaddr.rs, as loopback addressing is now handled in the main network module.
These changes lay the foundation for advanced networking features, improved testability (via loopback), and easier extension for future protocols and socket types.