1 #ifndef _SYS_RESOURCE_H_ 2 #define _SYS_RESOURCE_H_ 3 4 #include <sys/time.h> 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 #define RLIMIT_CPU 0 /* CPU time in seconds */ 11 #define RLIMIT_FSIZE 1 /* Maximum filesize */ 12 #define RLIMIT_DATA 2 /* max data size */ 13 #define RLIMIT_STACK 3 /* max stack size */ 14 #define RLIMIT_CORE 4 /* max core file size */ 15 #define RLIMIT_NOFILE 5 /* max number of open files */ 16 #define RLIMIT_OFILE RLIMIT_NOFILE /* BSD name */ 17 #define RLIMIT_AS 6 /* address space (virt. memory) limit */ 18 19 #define RLIMIT_NLIMITS 7 /* upper bound of RLIMIT_* defines */ 20 #define RLIM_NLIMITS RLIMIT_NLIMITS 21 22 #define RLIM_INFINITY (0xffffffffUL) 23 #define RLIM_SAVED_MAX RLIM_INFINITY 24 #define RLIM_SAVED_CUR RLIM_INFINITY 25 26 typedef unsigned long rlim_t; 27 28 struct rlimit { 29 rlim_t rlim_cur; 30 rlim_t rlim_max; 31 }; 32 33 #define RUSAGE_SELF 0 /* calling process */ 34 #define RUSAGE_CHILDREN -1 /* terminated child processes */ 35 36 struct rusage { 37 struct timeval ru_utime; /* user time used */ 38 struct timeval ru_stime; /* system time used */ 39 long ru_maxrss; 40 long ru_ixrss; /* XXX: 0 */ 41 long ru_idrss; /* XXX: sum of rm_asrss */ 42 long ru_isrss; /* XXX: 0 */ 43 long ru_minflt; /* any page faults not requiring I/O */ 44 long ru_majflt; /* any page faults requiring I/O */ 45 long ru_nswap; /* swaps */ 46 long ru_inblock; /* block input operations */ 47 long ru_oublock; /* block output operations */ 48 long ru_msgsnd; /* messages sent */ 49 long ru_msgrcv; /* messages received */ 50 long ru_nsignals; /* signals received */ 51 long ru_nvcsw; /* voluntary context switches */ 52 long ru_nivcsw; /* involuntary " */ 53 #define ru_last ru_nivcsw 54 }; 55 56 int getrlimit (int __resource, struct rlimit *__rlp); 57 int setrlimit (int __resource, const struct rlimit *__rlp); 58 59 int getrusage (int __who, struct rusage *__rusage); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif |