New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASI,libc: fix libstd with wasi-libc linkage, and enable tests. #9227
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1e20a62
WASI,libc: enable tests.
mathetake 7814a2b
review: use defined flag for oflags.
mathetake 97560cd
Merge remote-tracking branch 'origin' into libc-wasi-test
mathetake ca4898c
Use std.buuiltin instead of importing builtin
mathetake 68617c9
Add comment about compiletime check.
mathetake File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2015-2021 Zig Contributors | ||
// This file is part of [zig](https://ziglang.org/), which is MIT licensed. | ||
// The MIT license requires this copyright notice to be included in all copies | ||
// and substantial portions of the software. | ||
usingnamespace @import("../os/bits.zig"); | ||
|
||
extern threadlocal var errno: c_int; | ||
|
||
pub fn _errno() *c_int { | ||
return &errno; | ||
} | ||
|
||
pub const pid_t = c_int; | ||
pub const uid_t = u32; | ||
pub const gid_t = u32; | ||
pub const off_t = i64; | ||
|
||
pub const libc_stat = extern struct { | ||
dev: i32, | ||
ino: ino_t, | ||
nlink: u64, | ||
|
||
mode: mode_t, | ||
uid: uid_t, | ||
gid: gid_t, | ||
__pad0: isize, | ||
rdev: i32, | ||
size: off_t, | ||
blksize: i32, | ||
blocks: i64, | ||
|
||
atimesec: time_t, | ||
atimensec: isize, | ||
mtimesec: time_t, | ||
mtimensec: isize, | ||
ctimesec: time_t, | ||
ctimensec: isize, | ||
|
||
pub fn atime(self: @This()) timespec { | ||
return timespec{ | ||
.tv_sec = self.atimesec, | ||
.tv_nsec = self.atimensec, | ||
}; | ||
} | ||
|
||
pub fn mtime(self: @This()) timespec { | ||
return timespec{ | ||
.tv_sec = self.mtimesec, | ||
.tv_nsec = self.mtimensec, | ||
}; | ||
} | ||
|
||
pub fn ctime(self: @This()) timespec { | ||
return timespec{ | ||
.tv_sec = self.ctimesec, | ||
.tv_nsec = self.ctimensec, | ||
}; | ||
} | ||
}; |
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
Oops, something went wrong.
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.
I think we can put all checks in one
if
.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.
yeah this is a little bit trick.. we need to remove out this if block since since the expression is not compiltime-known, and WASI doesn't have
os.flock
that's why I put the OS check prior to the if block. Added comment about this: 68617c9There 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.
Ah gotcha, makes sense!