Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / include_exp / sys / resource.h
1 /*
2  * Acess2 POSIX Emulation
3  * - By John Hodge (thePowersGang)
4  *
5  * sys/resource.h
6  * - (XSI) Resource Operations
7  */
8 #ifndef _LIBPOSIX__SYS__RESOURCE_H_
9 #define _LIBPOSIX__SYS__RESOURCE_H_
10
11 #include <sys/time.h>   // struct timeval
12
13 // (get|set)priority(which)
14 enum
15 {
16         PRIO_PROCESS,
17         PRIO_PGRP,
18         PRIO_USER
19 };
20
21 typedef unsigned int    rlim_t;
22 #define RLIM_INFINITY   -1
23 #define RLIM_SAVED_MAX  -2
24 #define RLIM_SAVED_CUR  -3
25
26 struct rlimit
27 {
28         rlim_t  rlim_cur;
29         rlim_t  rlim_max;
30 };
31
32 // (get|set)r(limit|usage) resource values
33 enum
34 {
35         RLIMIT_AS,      // Address space size
36         RLIMIT_CORE,    // Max core file size
37         RLIMIT_CPU,     // CPU time limit in s (SIGXCPU when reached)
38         RLIMIT_DATA,
39         // TODO: More?
40 };
41
42 struct rusage
43 {
44         struct timeval  ru_time;
45         struct timeval  ru_stime;
46 };
47
48 extern int      getpriority(int, id_t);
49 extern int      getrlimit(int resource, struct rlimit *rlim);
50 extern int      getrusage(int resource, struct rusage *rusage);
51 extern int      setpriority(int, id_t, int);
52 extern int      setrlimit(int resource, const struct rlimit *rlim);
53
54 #endif
55

UCC git Repository :: git.ucc.asn.au