fix getrlimit handling on 32-bit systems, and ease porting to 64-bit