Penguin

Differences between current version and revision by previous author of getrusage(2).

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 4 Last edited on Tuesday, December 31, 2002 2:06:29 am by PerryLorier
Older page: version 1 Last edited on Tuesday, June 4, 2002 12:23:41 am by perry Revert
@@ -1,142 +1,46 @@
-GETRLIMIT  
-!!!GETRLIMIT  
-NAME  
-SYNOPSIS  
-DESCRIPTION  
-RETURN VALUE  
-ERRORS  
-CONFORMING TO  
-NOTE  
-SEE ALSO  
-----  
 !!NAME 
-  
-  
-getrlimit, getrusage, setrlimit - get/set resource limits and usage 
+getrusage - get resource usage 
 !!SYNOPSIS 
+ __#include <sys/time.h>__  
+ __#include <sys/resource.h>__  
+ __#include <unistd.h>__  
  
+ __int getrusage (int__ ''who''__, struct rusage *__''usage''__);__  
  
-__#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 
+getrusage(2) returns the current resource usages, for a ''who'' of either __RUSAGE_SELF__ or __RUSAGE_CHILDREN.__  
  
-  
-__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 */  
-}; 
+ 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. 
+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]: getrusage(2) is called with a bad ''who''.  
  
-  
-__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  
  
-  
-SVr4, BSD 4.3  
 !!NOTE 
+Including ''<sys/time.h>'' is not required these days, but increases portability. (Indeed, ''struct timeval'' is defined in ''<sys/time.h>''.)  
  
+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.  
  
-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) 
-----  
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.