Module sys/file

sys/file

Async and sync file operations.

Provides low-level file I/O wrappers around the C runtime externs.

Async operations return IOFuture which resolves to:

  • Positive value: success (fd for open, bytes for read/write, 0 for others)
  • Negative value: -errno on failure

Functions

openat function
fn(dirfd : i32, path : *(u8), flags : i32, mode : i32) -> IOFuture

Parameters

NameTypeNotes
dirfdi32
path*(u8)
flagsi32
modei32

Returns: IOFuture

close function
fn(fd : i32) -> IOFuture

Parameters

NameTypeNotes
fdi32

Returns: IOFuture

read function
fn(fd : i32, buffer : *(u8), size : u32, offset : u64) -> IOFuture

Parameters

NameTypeNotes
fdi32
buffer*(u8)
sizeu32
offsetu64

Returns: IOFuture

write function
fn(fd : i32, buffer : *(u8), size : u32, offset : u64) -> IOFuture

Parameters

NameTypeNotes
fdi32
buffer*(u8)
sizeu32
offsetu64

Returns: IOFuture

statx function
fn(dirfd : i32, path : *(u8), flags : i32, mask : u32, statxbuf : *(u8)) -> IOFuture

Parameters

NameTypeNotes
dirfdi32
path*(u8)
flagsi32
masku32
statxbuf*(u8)

Returns: IOFuture

fsync function
fn(fd : i32) -> IOFuture

Parameters

NameTypeNotes
fdi32

Returns: IOFuture

fdatasync function
fn(fd : i32) -> IOFuture

Parameters

NameTypeNotes
fdi32

Returns: IOFuture

ftruncate function
fn(fd : i32, length : i64) -> IOFuture

Parameters

NameTypeNotes
fdi32
lengthi64

Returns: IOFuture

open_sync function
fn(path : *(u8), flags : i32, mode : i32) -> i32

Parameters

NameTypeNotes
path*(u8)
flagsi32
modei32

Returns: i32

close_sync function
fn(fd : i32) -> unit

Parameters

NameTypeNotes
fdi32

Returns: unit

file_size function
fn(fd : i32) -> i64

Parameters

NameTypeNotes
fdi32

Returns: i64