[libc-commits] [PATCH] D159104: [libc] Fix setrlimit/getrlimit on 32-bit systems

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Sep 5 12:45:04 PDT 2023


sivachandra added a comment.

I think we can define `rlim_t` to be 64-bit type always and add an internal type for use with the syscall:

  struct RLimits64 {
    uint64_t rlim_cur;
    uint64_t rlim_max;
  };
  
  .. getrlimit(... *limits) {
    RLimits64 limits64;
    syscall_impl(SYS_prlimit64, ..., &limits64);
    limits->rlim_cur = static_cast<decltype(limits->rlim_cur)>(limits64.rlim_cur);
    ...
  }

This way, we ensure that the implementation is overlay mode safe as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159104/new/

https://reviews.llvm.org/D159104



More information about the libc-commits mailing list