authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-28 12:46:44-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-28 12:46:44-04:00
logc518b7b8bf71ad77adc96b5c9dabea277fe3ee43
treecc5d15a0a272ac17b50ad98eb8a22fb3131049d9
parent381f845287c8aef25a5351be81dfdfad055f0785
signaturelock-open Commit is signed but in an unrecognized format.

thread.spawn: bubble up mprotect error.OutOfMemory


2 files changed, 9 insertions(+), 1 deletions(-)

std/os.zig+9
...@@ -1883,7 +1883,16 @@ pub fn inotify_rm_watch(inotify_fd: i32, wd: i32) void {...@@ -1883,7 +1883,16 @@ pub fn inotify_rm_watch(inotify_fd: i32, wd: i32) void {
1883}1883}
18841884
1885pub const MProtectError = error{1885pub const MProtectError = error{
1886 /// The memory cannot be given the specified access. This can happen, for example, if you
1887 /// mmap(2) a file to which you have read-only access, then ask mprotect() to mark it
1888 /// PROT_WRITE.
1886 AccessDenied,1889 AccessDenied,
1890
1891 /// Changing the protection of a memory region would result in the total number of map‐
1892 /// pings with distinct attributes (e.g., read versus read/write protection) exceeding the
1893 /// allowed maximum. (For example, making the protection of a range PROT_READ in the mid‐
1894 /// dle of a region currently protected as PROT_READ|PROT_WRITE would result in three map‐
1895 /// pings: two read/write mappings at each end and a read-only mapping in the middle.)
1887 OutOfMemory,1896 OutOfMemory,
1888 Unexpected,1897 Unexpected,
1889};1898};
std/thread.zig-1
...@@ -277,7 +277,6 @@ pub const Thread = struct {...@@ -277,7 +277,6 @@ pub const Thread = struct {
277 mmap_slice,277 mmap_slice,
278 os.PROT_READ | os.PROT_WRITE,278 os.PROT_READ | os.PROT_WRITE,
279 ) catch |err| switch (err) {279 ) catch |err| switch (err) {
280 error.OutOfMemory => unreachable,
281 error.AccessDenied => unreachable,280 error.AccessDenied => unreachable,
282 else => |e| return e,281 else => |e| return e,
283 };282 };