This repository has been archived by the owner on Nov 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Implement fd_filestat_get for all platforms #42
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8cbeb48
Implement fd_filestat_get for all platforms
marmistrz b286fd6
Remove an old comment
marmistrz 75efa13
Remove panics from the syscall wrappers
marmistrz 1b21b05
Return WASI error type
marmistrz 27bbb50
Reuse Metadata if possible to save syscalls.
marmistrz 7cef07b
Refactor the change for two separate fd_filestat_get_impl
marmistrz d591585
Refactor error handling
marmistrz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use crate::{host, Result}; | ||
use std::convert::TryInto; | ||
use std::time::{SystemTime, UNIX_EPOCH}; | ||
pub(crate) fn systemtime_to_timestamp(st: SystemTime) -> Result<u64> { | ||
st.duration_since(UNIX_EPOCH) | ||
.map_err(|_| host::__WASI_EINVAL)? // date earlier than UNIX_EPOCH | ||
.as_nanos() | ||
.try_into() | ||
.map_err(|_| host::__WASI_EOVERFLOW) // u128 doesn't fit into u64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
|
||
mod ctx; | ||
mod fdentry; | ||
mod helpers; | ||
mod hostcalls_impl; | ||
mod sys; | ||
#[macro_use] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of like the Unix implementation, could this operate on
fs::Metadata
or some similar structure which is only created once instead of being created multiple times?