Files
llvm-tms34010/libc/docs
Pavel Labath aa1081f2c4 [libc] Introduce a typed syscall wrapper and use it in mmap (#197459)
Linux reserves a range of values (everything above -4096u, aka
MAX_ERRNO) as an error value, so the check can be performed without
knowing the details of the specific syscall. libc functions where these
values would be a valid result (e.g. PTRACE_PEEKDATA) are implemented
differently at the kernel level (e.g. returning the result through a
pointer argument). The only exception are a handful of syscalls (getpid,
getuid, ...) which can never fail, and where this could be an actual
user/group ID (particularly on 32-bit systems).

Specifically, for mmap, this lets us remove the is_valid_mmap helper and
SYS_mmap2 ifdefs in various places.

More generally, this can simplify many syscall wrappers as often the
only thing they are doing is converting the return value into an
ErrorOr.
2026-05-18 08:09:25 +02:00
..