Skip to content

Commit

Permalink
Replace libc with rustix in stak-file (#2015)
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe authored Jan 18, 2025
1 parent d0a5561 commit 6895042
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 61 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 109 additions & 1 deletion cmd/minimal/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"coreutils",
"doctest",
"embeddable",
"errno",
"exif",
"expt",
"fclose",
Expand Down Expand Up @@ -69,6 +70,7 @@
"rposition",
"rustc",
"rustfmt",
"rustix",
"rustup",
"stak",
"uninlined",
Expand Down
8 changes: 5 additions & 3 deletions file/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ readme.workspace = true
repository.workspace = true

[features]
libc = ["dep:libc"]
libc = ["dep:rustix"]
std = []

[dependencies]
heapless = "0.8.0"
libc = { version = "0.2", default-features = false, optional = true }
heapless = { version = "0.8.0", default-features = false }
rustix = { version = "0.38.43", default-features = false, features = [
"fs",
], optional = true }
stak-vm = { version = "0.7.21", path = "../vm" }

[dev-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions file/src/file_system/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pub enum FileError {
Open,
/// A close failure.
Close,
/// An invalid file descriptor.
InvalidFileDescriptor,
/// A read failure.
Read,
/// A write failure.
Expand All @@ -29,6 +31,7 @@ impl Display for FileError {
match self {
Self::Open => write!(formatter, "cannot open file"),
Self::Close => write!(formatter, "cannot close file"),
Self::InvalidFileDescriptor => write!(formatter, "invalid file descriptor"),
Self::Read => write!(formatter, "cannot read file"),
Self::Write => write!(formatter, "cannot write file"),
Self::Delete => write!(formatter, "cannot delete file"),
Expand Down
Loading

0 comments on commit 6895042

Please sign in to comment.