2 * Copyright 2003-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _SYS_RESOURCE_H
6 #define _SYS_RESOURCE_H
9 #include <config/types.h>
11 #include <sys/cdefs.h>
15 /* getrlimit()/setrlimit() definitions */
17 typedef __haiku_addr_t rlim_t
;
20 rlim_t rlim_cur
; /* current soft limit */
21 rlim_t rlim_max
; /* hard limit */
24 /* ToDo: the only supported mode is RLIMIT_NOFILE right now */
25 #define RLIMIT_CORE 0 /* size of the core file */
26 #define RLIMIT_CPU 1 /* CPU time per team */
27 #define RLIMIT_DATA 2 /* data segment size */
28 #define RLIMIT_FSIZE 3 /* file size */
29 #define RLIMIT_NOFILE 4 /* number of open files */
30 #define RLIMIT_STACK 5 /* stack size */
31 #define RLIMIT_AS 6 /* address space size */
33 #define RLIMIT_NOVMON 7 /* number of open vnode monitors */
35 #define RLIM_NLIMITS 8 /* number of resource limits */
37 #define RLIM_INFINITY (0xffffffffUL)
38 #define RLIM_SAVED_MAX RLIM_INFINITY
39 #define RLIM_SAVED_CUR RLIM_INFINITY
42 /* getrusage() definitions */
45 struct timeval ru_utime
; /* user time used */
46 struct timeval ru_stime
; /* system time used */
50 #define RUSAGE_CHILDREN -1
53 /* getpriority()/setpriority() definitions */
55 #define PRIO_PROCESS 0
62 extern int getrusage(int who
, struct rusage
*rusage
);
64 extern int getrlimit(int resource
, struct rlimit
* rlp
);
65 extern int setrlimit(int resource
, const struct rlimit
* rlp
);
67 /* ToDo: The following POSIX calls are missing (in BeOS as well):
68 * int getpriority(int which, id_t who);
69 * int setpriority(int which, id_t who, int priority); */
73 #endif /* _SYS_RESOURCE_H */