Expand description
System call interface module.
This module provides the system call interface for the Scarlet kernel using a hybrid capability-based design that balances type safety with practical usability.
§System Call Number Organization
The system calls are organized into logical ranges:
- 1-99: Process and task management (exit, clone, exec, getpid, brk, etc.)
- 100-199: Handle management operations (handle_query, handle_close, dup)
- 200-299: StreamOps capability (stream_read, stream_write operations)
- 300-399: FileObject capability (file_seek, file_truncate, file_metadata)
- 400-499: VFS operations (vfs_open, vfs_remove, vfs_create_directory, vfs_change_directory, vfs_truncate)
- 500-599: Filesystem operations (fs_mount, fs_umount, fs_pivot_root)
- 600-699: IPC operations (pipe, shared memory, message queues)
- 700-799: Memory mapping operations (memory_map, memory_unmap)
- 900-999: Socket operations (socket_create, bind, connect, accept, etc.)
Legacy POSIX-like system calls (20-35) are maintained for backward compatibility and redirect to the appropriate capability-based implementations.
§Current Implementation Status
§Process Management (1-99)
- Exit (1), Clone (2), Execve (3), ExecveABI (4), Waitpid (5)
- Getpid (7), Getppid (8), Brk (12), Sbrk (13)
- Basic I/O: Putchar (16), Getchar (17)
- ABI Zone: RegisterAbiZone (90), UnregisterAbiZone (91)
- Namespace: CreateNamespace (92) - Smart syscall for task/VFS isolation
§Handle Management (100-199)
- HandleQuery (100), HandleSetRole (101), HandleClose (102), HandleDuplicate (103)
§StreamOps Capability (200-299)
- StreamRead (200), StreamWrite (201)
§FileObject Capability (300-399)
- FileSeek (300), FileTruncate (301), FileMetadata (302)
§VFS Operations (400-499)
- VfsOpen (400), VfsRemove (401), VfsCreateFile (402), VfsCreateDirectory (403), VfsChangeDirectory (404), VfsTruncate (405), VfsCreateSymlink (406), VfsReadlink (407), VfsGetCwdPath (408)
§Filesystem Operations (500-599)
- FsMount (500), FsUmount (501), FsPivotRoot (502)
§IPC Operations (600-699)
- Pipe (600)
- Event Channels: Subscribe (610), Unsubscribe (611), Publish (612)
- Shared Memory: Create (620)
- Process Groups: not yet implemented
§Memory Mapping Operations (700-799)
- MemoryMap (700), MemoryUnmap (701)
§Socket Operations (900-999)
- SocketCreate (900), SocketBind (901), SocketListen (902), SocketConnect (903)
- SocketAccept (904), Socketpair (905), SocketShutdown (906)
§Task Event Operations (800-899)
- Basic Events: Send (800), SetAction (801), Block (802)
- Event Status: GetPending (803), HasPending (804)
- Signal-like Operations: Terminate, Kill, Interrupt, etc.
§Design Principles
- Capability-based security: Objects expose specific capabilities
- Type safety: Compile-time checking of valid operations
- Backward compatibility: Legacy APIs redirect to new implementations
- Clear semantics: Descriptive names (CreateDirectory vs mkdir)
§System Call Table
The system call table maps numbers to handler functions using the
syscall_table! macro for type safety and consistency.
Modules§
- macros 🔒
Enums§
Functions§
- sys_
profiler_ 🔒dump - Stub implementation when profiler feature is disabled
- syscall_
handler - Syscall handler