Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prlimit64() linux function

Does anyone know what the prlimit64() C function does? I don't seem to have it on my x86_64 Ubuntu machine but it exists in Arch, and I can't seem to find anyone or thing who knows what it does.

like image 720
Ben Stott Avatar asked Feb 22 '23 20:02

Ben Stott


2 Answers

prlimit allows you to set or get rlimit resource restrictions (such as number of file handles, memory, etc.) for another process. It is Linux-specific.

Normally, the restrictions you can set depend on the _FILE_OFFSET_BITS macro, which is 64 on all modern systems. Therefore, the members of the structures used by prlimit and friends are always 64 bit wide, no matter whether you're on a 32 or 64 bit system.

However, in the obscure case that _FILE_OFFSET_BITS is 32 (which means you can't correctly work with files larger than 2GiB), you need the alternative prlimit64 syscall to use 64 bit rlimits nonetheless.

like image 132
phihag Avatar answered Mar 04 '23 13:03

phihag


This is a tricky one; but it's the 64-bit version (whatever that means) of prlimit(); a Linux-specific function in the getrlimit(2) family.

It does not appear to be useful for 64-bit applications, as it relates to emulation of a 64-bit environment when one isn't available.

like image 33
Williham Totland Avatar answered Mar 04 '23 14:03

Williham Totland