Ben Stott
Ben Stott

Reputation: 2218

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.

Upvotes: 5

Views: 3488

Answers (2)

phihag
phihag

Reputation: 288080

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.

Upvotes: 5

Williham Totland
Williham Totland

Reputation: 29019

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.

Upvotes: 4

Related Questions