[libc-commits] [libc] [libc][mmap] force offset to long for mmap2 (PR #96522)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Jun 24 14:51:27 PDT 2024


nickdesaulniers wrote:

> an int64_t, i assume :-)

oops, yep. Will update commit message + description.

> in 2024, having two off_t types is deep into "historical cruft" territory.

Right, in terms of https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fFILE_005fOFFSET_005fBITS, I'd rather llvm-libc have the policy that `off_t` is 64b ALWAYS, regardless of ILP32 or LP64 data models.

> this sounds worse than what the actual change does --- you're actually only truncating offset >> 12, not the offset.

Will update the PR description.

> but why not just do the right thing? it's only a couple of lines. see bionic:

yeah, I was reading exactly that code.  Perhaps it's time to just fix mmap.  I don't think we quite need to provide `mmap2` or `mmap64` as symbols, and I don't think we should attempt to support kernels that lack `mmap2`.  Instead, it's probably just time to rewrite our mmap to not suck so much.

https://github.com/llvm/llvm-project/pull/96522


More information about the libc-commits mailing list