prlimit64() linux function

允我心安 提交于 2019-12-10 15:29:09

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8869229/prlimit64-linux-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!