There are some RLIMIT_* constants on Posix platforms which are not currently exposed in the resource module.
RLIMIT_NTHR. Available on NetBSD >= 7.0, QNX >= 6.3.2.
RLIMIT_UMTXP. Available on FreeBSD >= 11.
RLIMIT_PIPEBUF. Available in the main branch on FreeBSD (>= 15?) >= 14.2.
RLIMIT_THREADS. Available on AIX. The same as RLIMIT_NTHR?
RLIMIT_VMEM. Available on Solaris/OpenIndiana. On FreeBSD >= 5.3 it is an alias of RLIMIT_AS.
Constants RLIM_SAVED_CUR and RLIM_SAVED_MAX are used on some platforms (Solaris/OpenIndiana, AIX) to represent values that cannot be represented in 32-bit rlim_t.
It is perhaps too early to add RLIMIT_PIPEBUF.
RLIMIT_NTHR and RLIMIT_THREADS, should we only add one of them on the corresponding platform or add both names as aliases of one other?
RLIMIT_VMEM. Should we add it as an alias of RLIMIT_AS on all other platforms?
I am not sure whether RLIM_SAVED_CUR and RLIM_SAVED_MAX are still relevant on modern Unixes. Their use is complicated. They are the part of Posix, but not defined on Linux. On FreeBSD they are aliases of RLIM_INFINITY and are not useful at all.
As was pointed by @encukou, RLIM_SAVED_CUR and RLIM_SAVED_MAX are defined on Linux too as aliases of RLIM_INFINITY. They are a part of Posix, so should be defined everywhere (but may be useless).
Activity
serhiy-storchaka commented on Aug 7, 2025
On other look, RLIMIT_NTHR and RLIMIT_THREADS are different. The former is per user and the latter is per process.
serhiy-storchaka commented on Aug 7, 2025
Ah, RLIMIT_VMEM was already added.
pythongh-137512: Add new constants in the resource module
pythongh-137512: Add new constants in the resource module
pythongh-137512: Add new constants in the resource module
gh-137512: Add new constants in the resource module (GH-137513)
serhiy-storchaka commented on Aug 19, 2025
As was pointed by @encukou, RLIM_SAVED_CUR and RLIM_SAVED_MAX are defined on Linux too as aliases of RLIM_INFINITY. They are a part of Posix, so should be defined everywhere (but may be useless).
encukou commented on Aug 19, 2025
I did edit the message. The PR does add docs (and tests) for RLIMIT_PIPEBUF, and make other docs fixes.
pythongh-137512: Add new constants in the resource module (pythonGH-1…