Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
setrlimit(2)
Edit
PageHistory
Diff
Info
LikePages
GETRLIMIT !!!GETRLIMIT NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS CONFORMING TO NOTE SEE ALSO ---- !!NAME getrlimit, getrusage, setrlimit - get/set resource limits and usage !!SYNOPSIS __#include __ #include __ #include __ __int getrlimit (int__ ''resource''__, struct rlimit *__''rlim''__); int getrusage (int__ ''who''__, struct rusage *__''usage''__); int setrlimit (int__ ''resource''__, const struct rlimit *__''rlim''__);__ !!DESCRIPTION __getrlimit__ and __setrlimit__ get and set resource limits respectively. ''resource'' should be one of: __RLIMIT_CPU__ /* CPU time in seconds */__ RLIMIT_FSIZE__ /* Maximum filesize */__ RLIMIT_DATA__ /* max data size */__ RLIMIT_STACK__ /* max stack size */__ RLIMIT_CORE__ /* max core file size */__ RLIMIT_RSS__ /* max resident set size */__ RLIMIT_NPROC__ /* max number of processes */__ RLIMIT_NOFILE__ /* max number of open files */__ RLIMIT_MEMLOCK__ /* max locked-in-memory address space*/__ RLIMIT_AS__ /* address space (virtual memory) limit */ A resource may unlimited if you set the limit to __RLIM_INFINITY__. __RLIMIT_OFILE__ is the BSD name for __RLIMIT_NOFILE__. The __rlimit__ structure is defined as follows : struct rlimit { rlim_t rlim_cur; rlim_t rlim_max; }; __getrusage__ returns the current resource usages, for a ''who'' of either __RUSAGE_SELF__ or __RUSAGE_CHILDREN.__ struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ long ru_maxrss; /* maximum resident set size */ long ru_ixrss; /* integral shared memory size */ long ru_idrss; /* integral unshared data size */ long ru_isrss; /* integral unshared stack size */ long ru_minflt; /* page reclaims */ long ru_majflt; /* page faults */ long ru_nswap; /* swaps */ long ru_inblock; /* block input operations */ long ru_oublock; /* block output operations */ long ru_msgsnd; /* messages sent */ long ru_msgrcv; /* messages received */ long ru_nsignals; /* signals received */ long ru_nvcsw; /* voluntary context switches */ long ru_nivcsw; /* involuntary context switches */ }; !!RETURN VALUE On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately. !!ERRORS __EFAULT__ ''rlim'' or ''usage'' points outside the accessible address space. __EINVAL__ __getrlimit__ or __setrlimit__ is called with a bad ''resource'', or __getrusage__ is called with a bad ''who''. __EPERM__ A non-superuser tries to use __setrlimit()__ to increase the soft or hard limit above the current hard limit, or a superuser tries to increase RLIMIT_NOFILE above the current kernel maximum. !!CONFORMING TO SVr4, BSD 4.3 !!NOTE Including '''' is not required these days, but increases portability. (Indeed, ''struct timeval'' is defined in ''''.) The above struct was taken from BSD 4.3 Reno. Not all fields are meaningful under Linux. Right now (Linux 2.4) only the fields __ru_utime__, __ru_stime__, __ru_minflt__, __ru_majflt__, and __ru_nswap__ are maintained. !!SEE ALSO quotactl(2), ulimit(3) ----
6 pages link to
setrlimit(2)
:
Man2s
csh(1)
sbrk(2)
ulimit(3)
brk(2)
quotactl(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.