9.48 rlimit

#define RLIMIT_CORE   1 // Size of core files, 0 for disabling.
#define RLIMIT_CPU    2 // CPU time limit in seconds.
#define RLIMIT_FSIZE  4 // Maximum file size in bytes.
#define RLIMIT_NOFILE 5 // Maximum number of open file descriptors.
#define RLIMIT_STACK  6 // Maximum stack size in bytes.
#define RLIMIT_AS     7 // Maximum memory size in bytes.

struct ulimit {
    uint64_t soft;
    uint64_t hard;
};

int rlimit(int resource, struct ulimit *new, struct ulimit *old);

This syscall fetches and sets current limits for a specified resource, hard limits can only be lowered, are inherited from parent to children, and start maxed out. Soft limits can be moved around.

The available limits are:

This syscall returns 0 on success or -1 on failure, with the following errno: