diff options
| author | Jan Philipp Hafer <jan.hafer@rwth-aachen.de> | 2023-03-05 18:41:52 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-03-08 13:00:06 -0500 |
| commit | 06b263825a67e68cec128c640a6287fa1716dc63 (patch) | |
| tree | f9f3d68397896b22051241785620a2baa08e3f90 /lib/std/Thread.zig | |
| parent | ecc0108cea97772b6e921b36d8fdc8f90d5fc6cb (diff) | |
| download | zig-06b263825a67e68cec128c640a6287fa1716dc63.tar.gz zig-06b263825a67e68cec128c640a6287fa1716dc63.zip | |
std.os: add missing mmap errors
Man page for posix lists EMFILE, man page for linux ENFILE.
Also posix says "The mmap() function adds an extra reference to the file
associated with the file descriptor fildes which is not removed by a
subsequent close() on that file descriptor. This reference is removed
when there are no more mappings to the file."
It sounds counter-intuitive, that a process limit but no system limit can
be exceeeded.
As far as I understand, fildes is only used for file descriptor backed mmaps.
Diffstat (limited to 'lib/std/Thread.zig')
| -rw-r--r-- | lib/std/Thread.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 8004f94d7f..27f7fa5030 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -945,6 +945,7 @@ const LinuxThreadImpl = struct { // map all memory needed without read/write permissions // to avoid committing the whole region right away + // anonymous mapping ensures file descriptor limits are not exceeded const mapped = os.mmap( null, map_bytes, @@ -956,6 +957,8 @@ const LinuxThreadImpl = struct { error.MemoryMappingNotSupported => unreachable, error.AccessDenied => unreachable, error.PermissionDenied => unreachable, + error.ProcessFdQuotaExceeded => unreachable, + error.SystemFdQuotaExceeded => unreachable, else => |e| return e, }; assert(mapped.len >= map_bytes); |
