LIM_CUR(9) Kernel Developer's Manual LIM_CUR(9)

lim_cur, lim_cur_proc, lim_fork, lim_free, lim_read_enter, lim_read_leaveResource limit interface

#include <sys/types.h>
#include <sys/resourcevar.h>

rlim_t
lim_cur(int which);

rlim_t
lim_cur_proc(struct proc *p, int which);

struct plimit *
lim_fork(struct process *parent, struct process *child);

void
lim_free(struct plimit *limit);

struct plimit *
lim_read_enter();

void
lim_read_leave(struct plimit *limit);

The resource limit interface provides read access to the resource limits of the process.

() returns the value of limit which of the current process. The which can take one of the following values:

#define RLIMIT_CPU	0	/* cpu time in milliseconds */
#define RLIMIT_FSIZE	1	/* maximum file size */
#define RLIMIT_DATA	2	/* data size */
#define RLIMIT_STACK	3	/* stack size */
#define RLIMIT_CORE	4	/* core file size */
#define RLIMIT_RSS	5	/* resident set size */
#define RLIMIT_MEMLOCK	6	/* locked-in-memory address space */
#define RLIMIT_NPROC	7	/* number of processes */
#define RLIMIT_NOFILE	8	/* number of open files */

() is like lim_cur() but returns the value of limit which of thread p.

() begins read access to the current process' resource limit structure.

() finishes read access to the resource limit structure.

Sections denoted by () and lim_read_leave() cannot nest. Using lim_cur() inside the read section is not allowed because the function uses lim_read_enter() and lim_read_leave() internally.

() releases the reference limit.

() makes the process child share the resource limits of process parent.

lim_cur(), lim_cur_proc(), lim_fork(), lim_free(), lim_read_enter() and lim_read_leave() can be called during autoconf, or from process context.

lim_cur() and lim_cur_proc() return the value of the given resource limit.

lim_read_enter() returns a read reference to the current process' resource limits.

June 21, 2019 OpenBSD 7.6