Module sys/dir

sys/dir
Stability: unstable — a raw, errno-oriented wrapper over the C directory calls, and not the surface a caller wants: results come back as a bare `i32` that is either a count or `-errno`, and `getdents` hands back a byte buffer the caller has to walk itself. `std/fs` is the typed face (`Dir`, `read_dir`, `create_dir_all`, `remove_dir_all`), it returns `Result(_, IoError)`, and it is what should be imported. This module freezes, if ever, as an implementation detail of `std/fs`; the more likely end state is that it goes `_`-private once `std/fs` covers the last direct caller. — stable modules only change additively; this one may still change.

Directory operations.

Provides low-level directory manipulation wrappers around C runtime externs.

Async operations (mkdir, unlink, rename, symlink, link, getdents) return IoFuture which resolves to:

  • 0 on success (for mkdir, unlink, rename, symlink, link)
  • Bytes read for getdents
  • Negative value: -errno on failure

Stability

unstable — a raw, errno-oriented wrapper over the C directory calls, and not the surface a caller wants: results come back as a bare i32 that is either a count or -errno, and getdents hands back a byte buffer the caller has to walk itself. std/fs is the typed face (Dir, read_dir, create_dir_all, remove_dir_all), it returns Result(_, IoError), and it is what should be imported.

This module freezes, if ever, as an implementation detail of std/fs; the more likely end state is that it goes _-private once std/fs covers the last direct caller.

Functions

mkdir function
fn(dirfd : i32, path : *u8, mode : i32) -> IoFuture

Parameters

NameTypeNotes
dirfdi32
path*u8
modei32

Returns: IoFuture

rename function
fn(olddirfd : i32, oldpath : *u8, newdirfd : i32, newpath : *u8) -> IoFuture

Parameters

NameTypeNotes
olddirfdi32
oldpath*u8
newdirfdi32
newpath*u8

Returns: IoFuture

getdents function
fn(fd : i32, buf : *u8, buf_size : u32) -> IoFuture

Parameters

NameTypeNotes
fdi32
buf*u8
buf_sizeu32

Returns: IoFuture

dirent_size function
fn() -> usize

Returns: usize

dirent_reclen function
fn(entry : *u8) -> u16

Parameters

NameTypeNotes
entry*u8

Returns: u16

dirent_type function
fn(entry : *u8) -> u8

Parameters

NameTypeNotes
entry*u8

Returns: u8

dirent_name function
fn(entry : *u8) -> *u8

Parameters

NameTypeNotes
entry*u8

Returns: *u8

dirent_ino function
fn(entry : *u8) -> u64

Parameters

NameTypeNotes
entry*u8

Returns: u64