2021-07-03 13:47:20 +00:00
|
|
|
# MOROS Syscalls
|
|
|
|
|
2022-04-12 07:55:53 +00:00
|
|
|
This list is unstable and subject to change between versions of MOROS.
|
|
|
|
|
2022-04-10 07:27:12 +00:00
|
|
|
## EXIT (0x1)
|
2021-07-03 13:47:20 +00:00
|
|
|
|
|
|
|
```rust
|
2022-04-10 07:27:12 +00:00
|
|
|
pub fn exit(code: usize) -> usize
|
2021-07-03 13:47:20 +00:00
|
|
|
```
|
|
|
|
|
2022-04-10 07:27:12 +00:00
|
|
|
## SPAWN (0x2)
|
2021-07-03 13:47:20 +00:00
|
|
|
|
|
|
|
```rust
|
2022-04-10 07:27:12 +00:00
|
|
|
pub fn spawn(path: &str) -> isize
|
2021-07-03 13:47:20 +00:00
|
|
|
```
|
|
|
|
|
2022-04-10 07:27:12 +00:00
|
|
|
## READ (0x3)
|
2021-07-03 13:47:20 +00:00
|
|
|
|
|
|
|
```rust
|
2022-04-10 07:27:12 +00:00
|
|
|
pub fn read(handle: usize, buf: &mut [u8]) -> isize
|
|
|
|
```
|
|
|
|
|
|
|
|
## WRITE (0x4)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn write(handle: usize, buf: &mut [u8]) -> isize
|
|
|
|
```
|
|
|
|
|
|
|
|
## OPEN (0x5)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn open(path: &str, flags: usize) -> isize
|
|
|
|
```
|
|
|
|
|
|
|
|
## CLOSE (0x6)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn close(handle: usize)
|
|
|
|
```
|
|
|
|
|
|
|
|
## INFO (0x7)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn info(path: &str, info: &mut FileInfo) -> isize
|
|
|
|
```
|
|
|
|
|
|
|
|
## DUP (0x8)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn dup(old_handle: usize, new_handle: usize) -> isize
|
|
|
|
```
|
|
|
|
|
2022-06-05 11:58:05 +00:00
|
|
|
## DELETE (0x9)
|
2022-04-10 07:27:12 +00:00
|
|
|
|
|
|
|
```rust
|
2022-06-05 11:58:05 +00:00
|
|
|
pub fn delete(path: &str) -> isize
|
2022-04-10 07:27:12 +00:00
|
|
|
```
|
|
|
|
|
2022-06-05 11:58:05 +00:00
|
|
|
## STOP (0xA)
|
2022-04-10 07:27:12 +00:00
|
|
|
|
|
|
|
```rust
|
2022-06-05 11:58:05 +00:00
|
|
|
pub fn stop(code: usize)
|
2021-07-03 13:47:20 +00:00
|
|
|
```
|
2022-04-12 07:55:53 +00:00
|
|
|
|
2023-12-01 15:51:02 +00:00
|
|
|
The system will reboot with `0xCAFE` and halt with `0xDEAD`.
|
2022-06-08 18:51:02 +00:00
|
|
|
|
2022-06-05 11:58:05 +00:00
|
|
|
## SLEEP (0xB)
|
2022-04-12 07:55:53 +00:00
|
|
|
|
|
|
|
```rust
|
2022-06-05 11:58:05 +00:00
|
|
|
pub fn sleep(seconds: f64)
|
2022-04-12 07:55:53 +00:00
|
|
|
```
|
2023-07-29 14:24:45 +00:00
|
|
|
|
2023-12-01 15:51:02 +00:00
|
|
|
## POLL (0xC)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn poll(list: &[(usize, IO)]) -> isize
|
|
|
|
```
|
|
|
|
|
|
|
|
## CONNECT (0xD)
|
2023-07-29 14:24:45 +00:00
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn connect(handle, usize, addr: &str, port: u16) -> isize
|
|
|
|
```
|
|
|
|
|
2023-12-01 15:51:02 +00:00
|
|
|
## LISTEN (0xE)
|
2023-07-29 14:24:45 +00:00
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn listen(handle, usize, port: u16) -> isize
|
|
|
|
```
|
|
|
|
|
2023-12-01 15:51:02 +00:00
|
|
|
## ACCEPT (0xF)
|
2023-07-29 14:24:45 +00:00
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn accept(handle, usize, addr: &str) -> isize
|
|
|
|
```
|
2023-12-01 15:51:02 +00:00
|
|
|
|
|
|
|
## ALLOC (0x10)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn alloc(size: usize, align: usize) -> *mut u8
|
|
|
|
```
|
|
|
|
|
|
|
|
## FREE (0x11)
|
|
|
|
|
|
|
|
```rust
|
|
|
|
pub fn free(ptr: *mut u8, size: usize, align: usize)
|
|
|
|
```
|