PyDocs

Unix-specific services

resource

Unixnot WASI

This module provides basic mechanisms for measuring and controlling system resources utilized by a program.
Symbols in resource

e

error
Base class for I/O related errors.

g

getpagesize
Returns the number of bytes in a system page.
getrlimit
Returns a tuple (soft, hard) with the current soft and hard limits of resource.
getrusage
This function returns an object that describes the resources consumed by either the current process or its children, as specified by the who parameter.

p

prlimit
Combines setrlimit() and getrlimit() in one function and supports to get and set the resources limits of an arbitrary process.

r

RLIM_INFINITY
Constant used to represent the limit for an unlimited resource.
RLIM_SAVED_CUR
Constants used to represent the soft and hard limit values if they cannot be represented in the rlim_t value in C.
RLIM_SAVED_MAX
Constants used to represent the soft and hard limit values if they cannot be represented in the rlim_t value in C.
RLIMIT_AS
The maximum area (in bytes) of address space which may be taken by the process.
RLIMIT_CORE
The maximum size (in bytes) of a core file that the current process can create.
RLIMIT_CPU
The maximum amount of processor time (in seconds) that a process can use.
RLIMIT_DATA
The maximum size (in bytes) of the process’s heap.
RLIMIT_FSIZE
The maximum size of a file which the process may create.
RLIMIT_KQUEUES
The maximum number of kqueues this user id is allowed to create.
RLIMIT_MEMLOCK
The maximum address space which may be locked in memory.
RLIMIT_MSGQUEUE
The number of bytes that can be allocated for POSIX message queues.
RLIMIT_NICE
The ceiling for the process’s nice level (calculated as 20 - rlim_cur).
RLIMIT_NOFILE
The maximum number of open file descriptors for the current process.
RLIMIT_NPROC
The maximum number of processes the current process may create.
RLIMIT_NPTS
The maximum number of pseudo-terminals created by this user id.
RLIMIT_NTHR
The maximum number of threads for this user id, not counting the main and kernel threads.
RLIMIT_OFILE
The BSD name for RLIMIT_NOFILE.
RLIMIT_PIPEBUF
The maximum total size of in-kernel buffers for bi-directional pipes/fifos that this user id is allowed to consume.
RLIMIT_RSS
The maximum resident set size that should be made available to the process.
RLIMIT_RTPRIO
The ceiling of the real-time priority.
RLIMIT_RTTIME
The time limit (in microseconds) on CPU time that a process can spend under real-time scheduling without making a blocking syscall.
RLIMIT_SBSIZE
The maximum size (in bytes) of socket buffer usage for this user.
RLIMIT_SIGPENDING
The number of signals which the process may queue.
RLIMIT_STACK
The maximum size (in bytes) of the call stack for the current process.
RLIMIT_SWAP
The maximum size (in bytes) of the swap space that may be reserved or used by all of this user id’s processes.
RLIMIT_THREADS
The maximum number of threads each process can create.
RLIMIT_UMTXP
The limit of the number of process-shared Posix thread library objects allocated by user id.
RLIMIT_VMEM
The largest area of mapped memory which the process may occupy.
RUSAGE_BOTH
Pass to getrusage() to request resources consumed by both the current process and child processes.
RUSAGE_CHILDREN
Pass to getrusage() to request resources consumed by child processes of the calling process which have been terminated and waited for.
RUSAGE_SELF
Pass to getrusage() to request resources consumed by the calling process, which is the sum of resources used by all threads in the process.
RUSAGE_THREAD
Pass to getrusage() to request resources consumed by the current thread.

s

setrlimit
Sets new limits of consumption of resource.