You're right, but in practice it won't make much of a difference with regard to the ABI, as both long and int fit in a single register on (almost all?) architectures that Linux and the BSDs support, so are going to be passed/returned in the same way. (EDIT: on 32-bit x86, both long and/int are 32-bits so argc will be passed on the stack; on 64-bit x86, it'll be passed in the edi/rdi register. On ARM both 32-bit and 64-bit, it'll be passed in r0 or x0 respectively; for the return values, all arches listed here will pass int/long using the same register, eax/rax on x86, and r0/x0 on ARM).
There might be some edge cases with regard to sign extension, but I can't think of how they would actually occur right now.
Shouldn't the
core::ffi::c_longs becore::ffi::c_intinstead?You're right, but in practice it won't make much of a difference with regard to the ABI, as both
longandintfit in a single register on (almost all?) architectures that Linux and the BSDs support, so are going to be passed/returned in the same way. (EDIT: on 32-bit x86, both long and/int are 32-bits so argc will be passed on the stack; on 64-bit x86, it'll be passed in theedi/rdiregister. On ARM both 32-bit and 64-bit, it'll be passed inr0orx0respectively; for the return values, all arches listed here will passint/longusing the same register,eax/raxon x86, andr0/x0on ARM).There might be some edge cases with regard to sign extension, but I can't think of how they would actually occur right now.
Pretty cool, but e.g. libc will very likely stay in memory regardless of whether it counts toward the RSS of this tool or not.
Both this article and the linked one about german-style strings are pretty interesting