DOCUMENTATION / V1.0.0 LTS

🔌 Matrice des APIs & Spécifications POSIX - OrbitOne Kernel

Ce document technique détaille la matrice de conformité des APIs, structures de données et appels système d'OrbitOne OS (implémentés en v0.2.1-enterprise et planifiés pour v1.0).


📊 Matrice d'Implémentation Globale (v0.2.1-Enterprise)

Domaine APIs / Syscalls Déjà Implémentés Statut v0.2.1 Cibles Futures (v0.3 / v1.0)
Processus & Tâches task, smp, execve (15), exit (1), yield (2), getpid (20) ✅ Opérationnel fork, waitpid, kill (signaux)
Mémoire Virtuelle brk (12), mmap (30), munmap (31), Paging 4-niveaux, W ⊕ X ✅ Opérationnel mprotect, mremap, swap
Système de Fichiers open, read, write, close, seek, stat, fstat, getdents64, rename, rmdir, truncate, chmod, chown, getcwd, chdir, quotactl, Ext2 R/W ✅ Opérationnel linkat, symlinkat, statvfs
Stockage & Disque Pilote ATA Direct DMA, Cache de secteurs LRU, Partitions MBR/GPT, Dynamic Mounts (mount, umount, /proc/mounts) ✅ Opérationnel AHCI NCQ, NVMe Queue Pairs
Réseau Sockets BSD (socket, bind, connect, send, recv, close), e1000 Ethernet, DHCP auto-bail, /proc/net/*, SDK liborbit::net ✅ Opérationnel listen, accept en mode non-bloquant async, TLS 1.3
Sécurité & Quotas Multi-User Quotas (SYS_QUOTACTL = 42), RLIMIT, usercopy Ring 3 / Ring 0, entropy RDRAND ✅ Opérationnel Namespaces, Chiffrement disque

📋 Table des matières

  1. Process Management APIs
  2. Memory Management APIs
  3. Filesystem APIs
  4. I/O & Device APIs
  5. Networking APIs
  6. Security APIs
  7. Signal/IPC APIs

Process Management APIs

Structures manquantes

// Actuellement: ABSENT
pub struct Process {
    pub pid: Pid,
    pub ppid: Pid,  // Parent PID
    pub state: ProcessState,
    pub priority: i32,
    pub regs: RegisterContext,  // CPU registers
    pub addr_space: VirtualAddressSpace,
    pub files: FileDescriptorTable,
    pub signals: SignalMask,
    pub exit_code: Option<i32>,
}

pub enum ProcessState {
    Ready,
    Running,
    Blocked(BlockReason),
    Stopped,
    Zombie,
}

pub enum BlockReason {
    WaitingForIO,
    WaitingForLock,
    WaitingForSignal,
}

pub struct ProcessControlBlock {
    pub process: Process,
    pub stack: Paging,
    pub heap: Paging,
    pub created_at: u64,
    pub cwd: PathBuf,
    pub umask: u32,
}

APIs manquantes

// Process creation/termination
pub fn fork() -> Result<Pid, Error>;              // Clone current process
pub fn exec(path: &str, args: &[&str]) -> !;     // Replace process image
pub fn spawn(path: &str) -> Result<Pid, Error>;  // New process (fork+exec)
pub fn wait(pid: Pid) -> Result<i32, Error>;     // Wait for process
pub fn waitpid(pid: Pid, flags: i32) -> Result<(Pid, i32), Error>;
pub fn exit(code: i32) -> !;                      // Terminate current
pub fn kill(pid: Pid, sig: Signal) -> Result<(), Error>;

// Process info
pub fn getpid() -> Pid;
pub fn getppid() -> Pid;
pub fn getuid() -> Uid;
pub fn setuid(uid: Uid) -> Result<(), Error>;
pub fn nice(priority: i32) -> Result<(), Error>;
pub fn sched_yield();

// Process groups
pub fn setpgid(pid: Pid, pgid: Pid) -> Result<(), Error>;
pub fn getpgid(pid: Pid) -> Result<Pid, Error>;

// Scheduler APIs
pub fn sched_get_priority_min(policy: SchedPolicy) -> i32;
pub fn sched_get_priority_max(policy: SchedPolicy) -> i32;
pub fn sched_setscheduler(pid: Pid, policy: SchedPolicy, param: SchedParam) -> Result<(), Error>;

Memory Management APIs

Structures manquantes

// Actuellement: Limité à bitmap + bump allocator
pub struct VirtualAddressSpace {
    pub page_tables: PageTable,
    pub regions: Vec<MemoryRegion>,
}

pub struct MemoryRegion {
    pub start: VirtAddr,
    pub size: usize,
    pub flags: MemoryFlags,
    pub name: &'static str,
}

pub struct MemoryMapping {
    pub virt: VirtAddr,
    pub phys: PhysAddr,
    pub flags: PageFlags,
}

pub struct PageTable {
    pub entries: [u64; 512],
    pub level: PageTableLevel,
}

// Virtual memory zones
pub struct VmmZone {
    pub start: VirtAddr,
    pub end: VirtAddr,
    pub allocator: Box<dyn Allocator>,
}

APIs manquantes

// Virtual memory management
pub fn mmap(addr: Option<VirtAddr>, size: usize, prot: MmapProt, flags: MmapFlags) 
    -> Result<VirtAddr, Error>;
pub fn munmap(addr: VirtAddr, size: usize) -> Result<(), Error>;
pub fn mprotect(addr: VirtAddr, size: usize, prot: MmapProt) -> Result<(), Error>;
pub fn mremap(old: VirtAddr, old_size: usize, new_size: usize, flags: RemapFlags) 
    -> Result<VirtAddr, Error>;

// Memory zones
pub fn brk(addr: VirtAddr) -> Result<VirtAddr, Error>;  // Heap break
pub fn sbrk(incr: isize) -> Result<VirtAddr, Error>;    // Increment heap

// Memory pages
pub fn mlock(addr: VirtAddr, size: usize) -> Result<(), Error>;    // Pin in RAM
pub fn munlock(addr: VirtAddr, size: usize) -> Result<(), Error>;  // Unpin
pub fn mlockall(flags: MlockFlags) -> Result<(), Error>;           // Lock all

// Memory info
pub fn get_page_size() -> usize;
pub fn get_phys_pages() -> usize;
pub fn get_avphys_pages() -> usize;

// Swapping (future)
pub fn swap_in_page(vaddr: VirtAddr) -> Result<(), Error>;
pub fn swap_out_page(vaddr: VirtAddr) -> Result<(), Error>;

Filesystem APIs

Structures manquantes

// Actuellement: VFS pseudo-statique, pas d'ext2/FAT
pub struct Inode {
    pub ino: Ino,
    pub size: u64,
    pub mode: u32,  // Permissions + type
    pub uid: Uid,
    pub gid: Gid,
    pub nlink: u32,
    pub atime: u64,
    pub mtime: u64,
    pub ctime: u64,
    pub blocks: Vec<BlockNo>,
}

pub struct DirectoryEntry {
    pub name: String,
    pub ino: Ino,
    pub rec_len: u16,
    pub name_len: u8,
    pub file_type: FileType,
}

pub struct SuperBlock {
    pub total_inodes: u32,
    pub total_blocks: u32,
    pub free_inodes: u32,
    pub free_blocks: u32,
    pub block_size: u32,
    pub inode_size: u32,
}

pub struct FileDescriptor {
    pub ino: Ino,
    pub offset: u64,
    pub flags: OpenFlags,
    pub refcount: usize,
}

pub struct Mount {
    pub path: PathBuf,
    pub fs: Box<dyn Filesystem>,
    pub flags: MountFlags,
}

APIs manquantes

// File operations
pub fn open(path: &str, flags: OpenFlags) -> Result<FileDesc, Error>;
pub fn close(fd: FileDesc) -> Result<(), Error>;
pub fn read(fd: FileDesc, buf: &mut [u8]) -> Result<usize, Error>;
pub fn write(fd: FileDesc, buf: &[u8]) -> Result<usize, Error>;
pub fn pread(fd: FileDesc, buf: &mut [u8], offset: u64) -> Result<usize, Error>;
pub fn pwrite(fd: FileDesc, buf: &[u8], offset: u64) -> Result<usize, Error>;
pub fn lseek(fd: FileDesc, offset: i64, whence: SeekFrom) -> Result<u64, Error>;
pub fn fsync(fd: FileDesc) -> Result<(), Error>;
pub fn fdatasync(fd: FileDesc) -> Result<(), Error>;
pub fn ftruncate(fd: FileDesc, size: u64) -> Result<(), Error>;

// Directory operations
pub fn mkdir(path: &str, mode: u32) -> Result<(), Error>;
pub fn rmdir(path: &str) -> Result<(), Error>;
pub fn opendir(path: &str) -> Result<DirStream, Error>;
pub fn readdir(dir: &mut DirStream) -> Result<Option<DirEntry>, Error>;
pub fn closedir(dir: DirStream) -> Result<(), Error>;
pub fn scandir(path: &str) -> Result<Vec<DirEntry>, Error>;
pub fn chdir(path: &str) -> Result<(), Error>;
pub fn getcwd() -> Result<PathBuf, Error>;

// File metadata
pub fn stat(path: &str) -> Result<Stat, Error>;
pub fn lstat(path: &str) -> Result<Stat, Error>;
pub fn fstat(fd: FileDesc) -> Result<Stat, Error>;
pub fn chmod(path: &str, mode: u32) -> Result<(), Error>;
pub fn fchmod(fd: FileDesc, mode: u32) -> Result<(), Error>;
pub fn chown(path: &str, uid: Uid, gid: Gid) -> Result<(), Error>;
pub fn fchown(fd: FileDesc, uid: Uid, gid: Gid) -> Result<(), Error>;

// File linking
pub fn link(oldpath: &str, newpath: &str) -> Result<(), Error>;
pub fn unlink(path: &str) -> Result<(), Error>;
pub fn symlink(target: &str, linkpath: &str) -> Result<(), Error>;
pub fn readlink(path: &str) -> Result<PathBuf, Error>;
pub fn rename(oldpath: &str, newpath: &str) -> Result<(), Error>;

// Filesystem operations
pub fn mount(source: &str, target: &str, fstype: &str, flags: MountFlags) 
    -> Result<(), Error>;
pub fn umount(target: &str) -> Result<(), Error>;
pub fn umount2(target: &str, flags: UmountFlags) -> Result<(), Error>;
pub fn statfs(path: &str) -> Result<Statfs, Error>;
pub fn fstatfs(fd: FileDesc) -> Result<Statfs, Error>;

// File descriptor operations
pub fn dup(fd: FileDesc) -> Result<FileDesc, Error>;
pub fn dup2(fd: FileDesc, new_fd: FileDesc) -> Result<FileDesc, Error>;
pub fn dup3(fd: FileDesc, new_fd: FileDesc, flags: OpenFlags) -> Result<FileDesc, Error>;
pub fn fcntl(fd: FileDesc, cmd: FcntlCmd, arg: usize) -> Result<i32, Error>;

I/O & Device APIs

Structures manquantes

// Actuellement: Serial + VGA uniquement
pub struct Device {
    pub major: u32,
    pub minor: u32,
    pub ops: DeviceOps,
}

pub trait DeviceOps {
    fn read(&self, offset: u64, buf: &mut [u8]) -> Result<usize, Error>;
    fn write(&self, offset: u64, buf: &[u8]) -> Result<usize, Error>;
    fn ioctl(&self, cmd: u32, arg: usize) -> Result<(), Error>;
    fn mmap(&self, offset: u64, size: usize) -> Result<VirtAddr, Error>;
}

pub struct BlockDevice {
    pub sector_size: u32,
    pub num_sectors: u64,
    pub ops: BlockDeviceOps,
}

pub trait BlockDeviceOps {
    fn read_sectors(&self, lba: u64, count: u32, buf: &mut [u8]) -> Result<u32, Error>;
    fn write_sectors(&self, lba: u64, count: u32, buf: &[u8]) -> Result<u32, Error>;
}

pub struct Partition {
    pub start: u64,
    pub size: u64,
    pub type_code: u8,
    pub flags: u8,
}

pub struct PartitionTable {
    pub partitions: Vec<Partition>,
}

APIs manquantes

// Device management
pub fn open_device(path: &str, flags: OpenFlags) -> Result<DevHandle, Error>;
pub fn ioctl(fd: FileDesc, cmd: u32, arg: *mut c_void) -> Result<(), Error>;
pub fn fcntl_nonblocking(fd: FileDesc, nonblocking: bool) -> Result<(), Error>;

// Polling & async I/O
pub fn select(nfds: usize, readfds: &mut FdSet, writefds: &mut FdSet, 
              exceptfds: &mut FdSet, timeout: Option<Duration>) 
    -> Result<i32, Error>;
pub fn poll(fds: &mut [PollFd], timeout: i32) -> Result<i32, Error>;
pub fn ppoll(fds: &mut [PollFd], timeout: Option<Duration>, sigmask: Option<&SigSet>) 
    -> Result<i32, Error>;

// Disk operations
pub fn read_sector(disk: u32, sector: u64, buf: &mut [u8]) -> Result<usize, Error>;
pub fn write_sector(disk: u32, sector: u64, buf: &[u8]) -> Result<usize, Error>;
pub fn list_partitions(disk: u32) -> Result<Vec<Partition>, Error>;

// Device discovery
pub fn scan_devices() -> Result<Vec<DeviceInfo>, Error>;
pub fn get_device_info(path: &str) -> Result<DeviceInfo, Error>;

Networking APIs

Structures manquantes

// Actuellement: ABSENT
pub struct Socket {
    pub family: AddressFamily,
    pub socktype: SocketType,
    pub protocol: u32,
    pub state: SocketState,
}

pub struct SockAddr {
    pub family: AddressFamily,
    pub data: [u8; 14],
}

pub struct SockAddrIn {
    pub family: AddressFamily,
    pub port: u16,
    pub addr: Ipv4Addr,
}

pub enum SocketState {
    Closed,
    Listen,
    Connected,
    Disconnected,
}

pub struct TcpStream {
    pub socket: Socket,
    pub local_addr: SockAddrIn,
    pub remote_addr: SockAddrIn,
}

pub struct UdpSocket {
    pub socket: Socket,
    pub local_addr: SockAddrIn,
}

APIs manquantes

// Socket operations
pub fn socket(family: AddressFamily, socktype: SocketType, protocol: i32) 
    -> Result<FileDesc, Error>;
pub fn bind(fd: FileDesc, addr: &SockAddr) -> Result<(), Error>;
pub fn listen(fd: FileDesc, backlog: i32) -> Result<(), Error>;
pub fn accept(fd: FileDesc, addr: &mut SockAddr) -> Result<FileDesc, Error>;
pub fn connect(fd: FileDesc, addr: &SockAddr) -> Result<(), Error>;
pub fn shutdown(fd: FileDesc, how: ShutdownHow) -> Result<(), Error>;

// Socket data transfer
pub fn send(fd: FileDesc, buf: &[u8], flags: SendFlags) -> Result<usize, Error>;
pub fn sendto(fd: FileDesc, buf: &[u8], addr: &SockAddr, flags: SendFlags) 
    -> Result<usize, Error>;
pub fn recv(fd: FileDesc, buf: &mut [u8], flags: RecvFlags) -> Result<usize, Error>;
pub fn recvfrom(fd: FileDesc, buf: &mut [u8], addr: &mut SockAddr, flags: RecvFlags) 
    -> Result<usize, Error>;

// Socket options
pub fn getsockopt(fd: FileDesc, level: i32, optname: i32, optval: &mut [u8]) 
    -> Result<usize, Error>;
pub fn setsockopt(fd: FileDesc, level: i32, optname: i32, optval: &[u8]) 
    -> Result<(), Error>;

// Network info
pub fn gethostname(name: &mut [u8]) -> Result<(), Error>;
pub fn sethostname(name: &[u8]) -> Result<(), Error>;
pub fn getaddrinfo(host: &str, service: &str) -> Result<Vec<AddrInfo>, Error>;
pub fn gethostbyname(name: &str) -> Result<Hostent, Error>;

Security APIs

Structures manquantes

// Actuellement: ABSENT
pub struct User {
    pub uid: Uid,
    pub gid: Gid,
    pub name: String,
    pub home: PathBuf,
    pub shell: PathBuf,
}

pub struct Group {
    pub gid: Gid,
    pub name: String,
    pub members: Vec<String>,
}

pub struct FileMode {
    pub owner_read: bool,
    pub owner_write: bool,
    pub owner_exec: bool,
    pub group_read: bool,
    pub group_write: bool,
    pub group_exec: bool,
    pub other_read: bool,
    pub other_write: bool,
    pub other_exec: bool,
    pub setuid: bool,
    pub setgid: bool,
    pub sticky: bool,
}

pub struct Capability {
    pub cap: u32,
}

pub struct Credential {
    pub uid: Uid,
    pub gid: Gid,
    pub euid: Uid,
    pub egid: Gid,
    pub caps: Vec<Capability>,
}

APIs manquantes

// User/Group operations
pub fn getuid() -> Uid;
pub fn geteuid() -> Uid;
pub fn getgid() -> Gid;
pub fn getegid() -> Gid;
pub fn setuid(uid: Uid) -> Result<(), Error>;
pub fn seteuid(euid: Uid) -> Result<(), Error>;
pub fn setgid(gid: Gid) -> Result<(), Error>;
pub fn setegid(egid: Gid) -> Result<(), Error>;
pub fn getgroups() -> Result<Vec<Gid>, Error>;
pub fn setgroups(groups: &[Gid]) -> Result<(), Error>;

// Permission checking
pub fn access(path: &str, mode: AccessMode) -> Result<(), Error>;
pub fn check_permission(ino: Ino, uid: Uid, gid: Gid, mode: u32) -> bool;

// Capabilities
pub fn capget(pid: Pid, hdr: &mut CapUserHeader) -> Result<(), Error>;
pub fn capset(pid: Pid, hdr: &CapUserHeader) -> Result<(), Error>;

// Audit
pub fn audit_log(event: &str, details: &str) -> Result<(), Error>;

Signal/IPC APIs

Structures manquantes

// Actuellement: ABSENT
pub struct SignalHandler {
    pub handler: SignalHandlerFn,
    pub mask: SigSet,
    pub flags: SigActionFlags,
}

pub struct SigSet {
    pub signals: u64,
}

pub struct SigAction {
    pub handler: SignalHandler,
    pub mask: SigSet,
    pub flags: SigActionFlags,
}

pub enum Signal {
    SIGHUP = 1,
    SIGINT = 2,
    SIGQUIT = 3,
    SIGILL = 4,
    // ... et 30+ autres
}

pub struct Pipe {
    pub read_fd: FileDesc,
    pub write_fd: FileDesc,
}

pub struct MessageQueue {
    pub id: i32,
    pub key: i32,
}

APIs manquantes

// Signal operations
pub fn signal(sig: Signal, handler: SignalHandler) -> Result<SignalHandler, Error>;
pub fn sigaction(sig: Signal, act: &SigAction, old_act: &mut SigAction) 
    -> Result<(), Error>;
pub fn sigprocmask(how: SigHow, set: &SigSet, oldset: &mut SigSet) 
    -> Result<(), Error>;
pub fn sigpending(set: &mut SigSet) -> Result<(), Error>;
pub fn sigsuspend(mask: &SigSet) -> Result<(), Error>;
pub fn pause() -> Result<(), Error>;
pub fn kill(pid: Pid, sig: Signal) -> Result<(), Error>;
pub fn raise(sig: Signal) -> Result<(), Error>;

// Pipe operations
pub fn pipe() -> Result<Pipe, Error>;
pub fn pipe2(flags: OpenFlags) -> Result<Pipe, Error>;

// Message queues
pub fn msgget(key: i32, flags: i32) -> Result<MessageQueueId, Error>;
pub fn msgsnd(qid: MessageQueueId, msg: &[u8], flags: i32) -> Result<(), Error>;
pub fn msgrcv(qid: MessageQueueId, buf: &mut [u8], flags: i32) 
    -> Result<usize, Error>;
pub fn msgctl(qid: MessageQueueId, cmd: i32) -> Result<(), Error>;

// Semaphores
pub fn semget(key: i32, nsems: i32, flags: i32) -> Result<SemaphoreId, Error>;
pub fn semop(sid: SemaphoreId, ops: &[SemOp]) -> Result<(), Error>;
pub fn semctl(sid: SemaphoreId, semnum: i32, cmd: i32) -> Result<(), Error>;

// Shared memory
pub fn shmget(key: i32, size: usize, flags: i32) -> Result<SharedMemId, Error>;
pub fn shmat(shid: SharedMemId, addr: Option<VirtAddr>) -> Result<VirtAddr, Error>;
pub fn shmdt(addr: VirtAddr) -> Result<(), Error>;
pub fn shmctl(shid: SharedMemId, cmd: i32) -> Result<(), Error>;

📊 Résumé API par priorité

API Domain P0 (Critique) P1 (Important) P2 (Souhaitable) P3 (Optionnel)
Process fork, exec, wait exit, kill, nice sched_*, pgid clone, vfork
Memory mmap, munmap brk, mprotect madvise swap ops
Filesystem open, close, read write, stat, chmod link, mount xattr
Device open, ioctl poll, select epoll aio
Network socket, connect send, recv poll TCP_NODELAY
Security uid/gid ops access, chmod capabilities audit
IPC pipe, fork+exec signals, msgq semaphores shm

🎯 Checklist implémentation

Phase 1 (v0.2-0.3): Basics

Phase 2 (v0.3-0.4): I/O

Phase 3 (v0.4-0.5): Security

Phase 4 (v0.5+): Advanced


Dernier mis à jour: 2026-07-20
API status: Planification pour v0.2+