<div dir="ltr">I forgot to mention in the previous message that glibc and musl also provide rlimit64, so changing rlim_t to always be 64 bit long makes rlimit64 the same as limit, which simplifies the code.<div><br></div><div>btw, musl simply does: </div><div><br>#define rlimit64 rlimit<br></div><div>#define rlim64_t rlim_t<br></div><div><br></div><div>while glibc actually defines the types. </div><div><br></div><div>Which way do you prefer, to use defines in the headers or to add new headers (like this PR does)? I'm assuming here that we want to define both rlim64_t and rlimit64 types.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter., 5 de set. de 2023 às 16:45, Siva Chandra via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">sivachandra added a comment.<br>
<br>
I think we can define `rlim_t` to be 64-bit type always and add an internal type for use with the syscall:<br>
<br>
  struct RLimits64 {<br>
    uint64_t rlim_cur;<br>
    uint64_t rlim_max;<br>
  };<br>
<br>
  .. getrlimit(... *limits) {<br>
    RLimits64 limits64;<br>
    syscall_impl(SYS_prlimit64, ..., &limits64);<br>
    limits->rlim_cur = static_cast<decltype(limits->rlim_cur)>(limits64.rlim_cur);<br>
    ...<br>
  }<br>
<br>
This way, we ensure that the implementation is overlay mode safe as well.<br>
<br>
<br>
Repository:<br>
  rG LLVM Github Monorepo<br>
<br>
CHANGES SINCE LAST ACTION<br>
  <a href="https://reviews.llvm.org/D159104/new/" rel="noreferrer" target="_blank">https://reviews.llvm.org/D159104/new/</a><br>
<br>
<a href="https://reviews.llvm.org/D159104" rel="noreferrer" target="_blank">https://reviews.llvm.org/D159104</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail R. Gadelha, Ph.D.</div></div></div>