LIM_CUR(9)
okay so welcome to LIM_CUR(9) from the Kernel Developer's Manual, bestie π this is literally the resource limit interface, and we're gonna read it together, no cap.
πΈ 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 gives you read access to the resource limits of the process. Iconic behavior, honestly π«Ά
lim_cur() returns the value of limit which of the current process. The which can take one of these values, and you're gonna want to keep them exactly as written:
#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. yes bestie, thread p, that's what it says π
lim_read_enter() begins read access to the current process' resource limit structure.
lim_read_leave() finishes read access to the resource limit structure.
π¨ okay so this part matters: sections denoted bylim_read_enter()andlim_read_leave()cannot nest. Usinglim_cur()inside the read section is not allowed because the function useslim_read_enter()andlim_read_leave()internally. do not try it, bestie π
lim_free() releases the reference limit.
lim_fork() makes the process child share the resource limits of process parent. sharing is caring, periodt π
π¦ 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. slay β¨
π RETURN VALUES π
lim_cur()andlim_cur_proc()return the value of the given resource limit.lim_read_enter()returns a read reference to the current process' resource limits.
mwah π β this cutie came from Debian, dated June 21, 2019, and yes bestie, it was the LIM_CUR(9) manual page. periodt π
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2019 Visa Hankala
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms