aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-08-10 23:02:04 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-08-11 06:22:05 -0400
commita82d7c20631b90de2f2298d351353041ac41650d (patch)
treeea10e8411448e594c15366657a7200e9b2bcb835 /lib
parent44a6172edbf6c99f4ebfeabb530756ed2a40c3c2 (diff)
downloadzig-a82d7c20631b90de2f2298d351353041ac41650d.tar.gz
zig-a82d7c20631b90de2f2298d351353041ac41650d.zip
std: add missing error to windows.WriteFile
I encountered this error today when testing the self-hosted compiler on Windows.
Diffstat (limited to 'lib')
-rw-r--r--lib/std/os.zig4
-rw-r--r--lib/std/os/windows.zig4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 1192c72629..2836ddf9c9 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -953,6 +953,10 @@ pub const WriteError = error{
OperationAborted,
NotOpenForWriting,
+ /// The process cannot access the file because another process has locked
+ /// a portion of the file. Windows-only.
+ LockViolation,
+
/// This error occurs when no global event loop is configured,
/// and reading from the file descriptor would block.
WouldBlock,
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index 3e42ee5f2d..c79ccb5113 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -517,6 +517,9 @@ pub const WriteFileError = error{
OperationAborted,
BrokenPipe,
NotOpenForWriting,
+ /// The process cannot access the file because another process has locked
+ /// a portion of the file.
+ LockViolation,
Unexpected,
};
@@ -597,6 +600,7 @@ pub fn WriteFile(
.IO_PENDING => unreachable,
.BROKEN_PIPE => return error.BrokenPipe,
.INVALID_HANDLE => return error.NotOpenForWriting,
+ .LOCK_VIOLATION => return error.LockViolation,
else => |err| return unexpectedError(err),
}
}