aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-05-01 23:17:15 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-05-01 23:17:28 -0400
commit45bce27b8fecda4fba1c22dd191030af29ccbc6f (patch)
tree946b5080cbe75dd1ef150ac830522a1ce40c526b /lib/std/os.zig
parent988031c07c1959b05682f007ed3bc848a75a43d0 (diff)
downloadzig-45bce27b8fecda4fba1c22dd191030af29ccbc6f.tar.gz
zig-45bce27b8fecda4fba1c22dd191030af29ccbc6f.zip
cleanup and fixes. behavior tests passing with evented I/O
Diffstat (limited to 'lib/std/os.zig')
-rw-r--r--lib/std/os.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 489afe43b7..05d8b60a2d 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -173,8 +173,8 @@ fn getRandomBytesDevURandom(buf: []u8) !void {
const file = std.fs.File{
.handle = fd,
- .io_mode = .blocking,
- .async_block_allowed = std.fs.File.async_block_allowed_yes,
+ .capable_io_mode = .blocking,
+ .intended_io_mode = .blocking,
};
const stream = file.inStream();
stream.readNoEof(buf) catch return error.Unexpected;
@@ -305,7 +305,7 @@ pub const ReadError = error{
/// For POSIX the limit is `math.maxInt(isize)`.
pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
if (builtin.os.tag == .windows) {
- return windows.ReadFile(fd, buf, null, false);
+ return windows.ReadFile(fd, buf, null, std.io.default_mode);
}
if (builtin.os.tag == .wasi and !builtin.link_libc) {
@@ -408,7 +408,7 @@ pub const PReadError = ReadError || error{Unseekable};
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {
if (builtin.os.tag == .windows) {
- return windows.ReadFile(fd, buf, offset, false);
+ return windows.ReadFile(fd, buf, offset, std.io.default_mode);
}
while (true) {
@@ -584,7 +584,7 @@ pub const WriteError = error{
/// The corresponding POSIX limit is `math.maxInt(isize)`.
pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
if (builtin.os.tag == .windows) {
- return windows.WriteFile(fd, bytes, null, false);
+ return windows.WriteFile(fd, bytes, null, std.io.default_mode);
}
if (builtin.os.tag == .wasi and !builtin.link_libc) {
@@ -709,7 +709,7 @@ pub const PWriteError = WriteError || error{Unseekable};
/// The corresponding POSIX limit is `math.maxInt(isize)`.
pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
if (std.Target.current.os.tag == .windows) {
- return windows.WriteFile(fd, bytes, offset, false);
+ return windows.WriteFile(fd, bytes, offset, std.io.default_mode);
}
// Prevent EINVAL.