Module syscall

Source
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)

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)

§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)

§Filesystem Operations (500-599)

  • FsMount (500), FsUmount (501), FsPivotRoot (502)

§IPC Operations (600-699)

  • Pipe (600)

§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§

Syscall

Functions§

syscall_handler
Syscall handler