diff --git a/std/os.zig b/std/os.zig index 14f205c1aa5d90937c7e726c94f4097fbd43f9b8..6f1f0135ce9301824dbac688f2a525840f02cdc7 100644 --- a/std/os.zig +++ b/std/os.zig @@ -1883,7 +1883,16 @@ pub fn inotify_rm_watch(inotify_fd: i32, wd: i32) void { } pub const MProtectError = error{ + /// The memory cannot be given the specified access. This can happen, for example, if you + /// mmap(2) a file to which you have read-only access, then ask mprotect() to mark it + /// PROT_WRITE. AccessDenied, + + /// Changing the protection of a memory region would result in the total number of map‐ + /// pings with distinct attributes (e.g., read versus read/write protection) exceeding the + /// allowed maximum. (For example, making the protection of a range PROT_READ in the mid‐ + /// dle of a region currently protected as PROT_READ|PROT_WRITE would result in three map‐ + /// pings: two read/write mappings at each end and a read-only mapping in the middle.) OutOfMemory, Unexpected, }; diff --git a/std/thread.zig b/std/thread.zig index afed605b39102e77daf2a4aec6f13c735a6f4ec7..abf2f1cae1304b6e98466c519201ed4a997ae4c2 100644 --- a/std/thread.zig +++ b/std/thread.zig @@ -277,7 +277,6 @@ pub const Thread = struct { mmap_slice, os.PROT_READ | os.PROT_WRITE, ) catch |err| switch (err) { - error.OutOfMemory => unreachable, error.AccessDenied => unreachable, else => |e| return e, };