LIM_CUR(9)

NAME
lim_cur, lim_cur_proc, lim_fork, lim_free, lim_read_enter, lim_read_leave - Resource limit interface

SYNOPSIS
#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);

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

lim_cur() 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 */

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

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

lim_read_leave() finishes read access to the resource limit structure.

Sections denoted by lim_read_enter() 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.

lim_free() releases the reference limit.

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

CONTEXT
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.

RETURN VALUES
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.