5.5 KiB
5.5 KiB
T11: Virtual Filesystem (VFS) & Sockets
Track: T11
Status: IN PROGRESS
Date: 2026-07-12
Source: UniversalisOS 12-Month Roadmap, Month 11
Overview
T11 focuses on enabling a fully functional virtual filesystem and networking endpoints for UniversalisOS. This includes fleshing out the VFS implementation, ensuring proper memory management, and implementing socket operations.
Objectives
- Flesh out VFS implementation — Complete VFS with proper memory management
- Implement VFS socket operations — socket, bind, listen, accept
- Ensure munmap correctly frees memory — Proper resource cleanup
- Add socket options — setsockopt, getsockopt
- Add socket I/O — send, recv, sendto, recvfrom
Tasks
T11-1: VFS Implementation Completion
Status: PENDING
Complete the VFS implementation with proper memory management:
/* VFS operations */
int vfs_open(const char* path, int flags, int mode, uint32_t part_id);
int vfs_close(int fd, uint32_t part_id);
int vfs_read(int fd, void* buf, size_t count, uint32_t part_id);
int vfs_write(int fd, const void* buf, size_t count, uint32_t part_id);
int vfs_lseek(int fd, int offset, int whence, uint32_t part_id);
int vfs_fstat(int fd, void* statbuf, uint32_t part_id);
int vfs_ioctl(int fd, int request, void* arg, uint32_t part_id);
Key Features:
- File descriptor table per partition
- Path resolution
- File operations (open, close, read, write, lseek)
- File status (fstat)
- I/O control (ioctl)
TODO:
- Implement fd table per partition
- Implement path resolution
- Implement file operations
- Implement fstat
- Implement ioctl
T11-2: VFS Socket Operations
Status: PENDING
Implement VFS socket operations:
/* Socket operations */
int vfs_socket(int domain, int type, int protocol, uint32_t part_id);
int vfs_bind(int sockfd, const void* addr, size_t addrlen, uint32_t part_id);
int vfs_listen(int sockfd, int backlog, uint32_t part_id);
int vfs_accept(int sockfd, void* addr, void* addrlen, uint32_t part_id);
int vfs_connect(int sockfd, const void* addr, size_t addrlen, uint32_t part_id);
Key Features:
- Socket creation (AF_INET, AF_UNIX, AF_INET6)
- Socket binding
- Connection listening
- Connection acceptance
- Connection establishment
TODO:
- Implement socket creation
- Implement socket binding
- Implement listen
- Implement accept
- Implement connect
T11-3: Socket I/O Operations
Status: PENDING
Implement socket I/O operations:
/* Socket I/O */
ssize_t vfs_send(int sockfd, const void* buf, size_t len, int flags, uint32_t part_id);
ssize_t vfs_recv(int sockfd, void* buf, size_t len, int flags, uint32_t part_id);
ssize_t vfs_sendto(int sockfd, const void* buf, size_t len, int flags, const void* dest_addr, size_t addrlen, uint32_t part_id);
ssize_t vfs_recvfrom(int sockfd, void* buf, size_t len, int flags, void* src_addr, size_t* addrlen, uint32_t part_id);
Key Features:
- Send data
- Receive data
- Send to specific address
- Receive from specific address
TODO:
- Implement send
- Implement recv
- Implement sendto
- Implement recvfrom
T11-4: Socket Options
Status: PENDING
Implement socket options:
/* Socket options */
int vfs_setsockopt(int sockfd, int level, int optname, const void* optval, size_t optlen, uint32_t part_id);
int vfs_getsockopt(int sockfd, int level, int optname, void* optval, size_t* optlen, uint32_t part_id);
Key Features:
- Set socket options (SO_REUSEADDR, SO_KEEPALIVE, etc.)
- Get socket options
TODO:
- Implement setsockopt
- Implement getsockopt
T11-5: Memory Management for VFS
Status: PENDING
Ensure proper memory management for VFS:
/* Memory management */
int vfs_munmap(void* addr, size_t length, uint32_t part_id);
void* vfs_mmap(void* addr, size_t length, int prot, int flags, int fd, int offset, uint32_t part_id);
Key Features:
- Proper munmap (free memory resources)
- Memory-mapped files
- Resource cleanup
TODO:
- Implement proper munmap
- Implement mmap for files
- Implement resource cleanup
Implementation Files
| File | Purpose |
|---|---|
kernel/src/core/vfs.h |
VFS header |
kernel/src/core/vfs.cpp |
VFS implementation |
kernel/src/core/abi/uos_posix_abi.cpp |
POSIX ABI dispatch |
kernel/src/core/abi/uos_posix_abi.h |
POSIX ABI header |
Verification
- VFS operations work correctly
- Socket operations work correctly
- Socket I/O works correctly
- Socket options work correctly
- Memory management works correctly
TODO Summary
T11-1: VFS Implementation
- Implement fd table per partition
- Implement path resolution
- Implement file operations
- Implement fstat
- Implement ioctl
T11-2: Socket Operations
- Implement socket creation
- Implement socket binding
- Implement listen
- Implement accept
- Implement connect
T11-3: Socket I/O
- Implement send
- Implement recv
- Implement sendto
- Implement recvfrom
T11-4: Socket Options
- Implement setsockopt
- Implement getsockopt
T11-5: Memory Management
- Implement proper munmap
- Implement mmap for files
- Implement resource cleanup
References
universalisos/docs/UniversalisOS_Stubs_Resolution_Roadmap_12Months.md— 12-month roadmapuniversalisos/kernel/src/core/vfs.cpp— VFS implementationuniversalisos/kernel/src/core/abi/uos_posix_abi.cpp— POSIX ABI dispatch