1 #ifndef _SYS_RESOURCE_H 2 #define _SYS_RESOURCE_H 3 /* 4 ** Distributed under the terms of the OpenBeOS License. 5 */ 6 7 8 #include <sys/time.h> 9 10 11 /* getrlimit()/setrlimit() definitions */ 12 13 typedef unsigned long rlim_t; 14 15 struct rlimit { 16 rlim_t rlim_cur; /* current soft limit */ 17 rlim_t rlim_max; /* hard limit */ 18 }; 19 20 // ToDo: the only supported mode is RLIMIT_NOFILE right now 21 #define RLIMIT_CORE 0 /* size of the core file */ 22 #define RLIMIT_CPU 1 /* CPU time per team */ 23 #define RLIMIT_DATA 2 /* data segment size */ 24 #define RLIMIT_FSIZE 3 /* file size */ 25 #define RLIMIT_NOFILE 4 /* number of open files */ 26 #define RLIMIT_STACK 5 /* stack size */ 27 #define RLIMIT_AS 6 /* address space size */ 28 /* Haiku-specifics */ 29 #define RLIMIT_NOVMON 7 /* number of open vnode monitors */ 30 31 #define RLIM_NLIMITS 8 /* number of resource limits */ 32 33 #define RLIM_INFINITY (0xffffffffUL) 34 #define RLIM_SAVED_MAX RLIM_INFINITY 35 #define RLIM_SAVED_CUR RLIM_INFINITY 36 37 38 /* getrusage() definitions */ 39 40 struct rusage { 41 struct timeval ru_utime; /* user time used */ 42 struct timeval ru_stime; /* system time used */ 43 }; 44 45 #define RUSAGE_SELF 0 46 #define RUSAGE_CHILDREN -1 47 48 49 /* getpriority()/setpriority() definitions */ 50 51 #define PRIO_PROCESS 0 52 #define PRIO_PGRP 1 53 #define PRIO_USER 2 54 55 56 #ifdef __cplusplus 57 extern "C" { 58 #endif 59 60 extern int getrusage(int who, struct rusage *rusage); 61 62 extern int getrlimit(int resource, struct rlimit * rlp); 63 extern int setrlimit(int resource, const struct rlimit * rlp); 64 65 // ToDo: The following POSIX calls are missing (in BeOS as well): 66 //int getpriority(int which, id_t who); 67 //int setpriority(int which, id_t who, int priority); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* _SYS_RESOURCE_H */ 74