OLD | NEW |
1 #ifndef»_SYS_RESOURCE_H | 1 #ifndef _SYS_RESOURCE_H |
2 #define»_SYS_RESOURCE_H | 2 #define _SYS_RESOURCE_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <features.h> | 8 #include <features.h> |
9 #include <sys/time.h> | 9 #include <sys/time.h> |
10 | 10 |
11 #define __NEED_id_t | 11 #define __NEED_id_t |
12 | 12 |
13 #ifdef _GNU_SOURCE | 13 #ifdef _GNU_SOURCE |
14 #define __NEED_pid_t | 14 #define __NEED_pid_t |
15 #endif | 15 #endif |
16 | 16 |
17 #include <bits/alltypes.h> | 17 #include <bits/alltypes.h> |
18 #include <bits/resource.h> | 18 #include <bits/resource.h> |
19 | 19 |
20 typedef unsigned long long rlim_t; | 20 typedef unsigned long long rlim_t; |
21 | 21 |
22 struct rlimit | 22 struct rlimit { |
23 { | 23 rlim_t rlim_cur; |
24 » rlim_t rlim_cur; | 24 rlim_t rlim_max; |
25 » rlim_t rlim_max; | |
26 }; | 25 }; |
27 | 26 |
28 struct rusage | 27 struct rusage { |
29 { | 28 struct timeval ru_utime; |
30 » struct timeval ru_utime; | 29 struct timeval ru_stime; |
31 » struct timeval ru_stime; | 30 /* linux extentions, but useful */ |
32 » /* linux extentions, but useful */ | 31 long ru_maxrss; |
33 » long» ru_maxrss; | 32 long ru_ixrss; |
34 » long» ru_ixrss; | 33 long ru_idrss; |
35 » long» ru_idrss; | 34 long ru_isrss; |
36 » long» ru_isrss; | 35 long ru_minflt; |
37 » long» ru_minflt; | 36 long ru_majflt; |
38 » long» ru_majflt; | 37 long ru_nswap; |
39 » long» ru_nswap; | 38 long ru_inblock; |
40 » long» ru_inblock; | 39 long ru_oublock; |
41 » long» ru_oublock; | 40 long ru_msgsnd; |
42 » long» ru_msgsnd; | 41 long ru_msgrcv; |
43 » long» ru_msgrcv; | 42 long ru_nsignals; |
44 » long» ru_nsignals; | 43 long ru_nvcsw; |
45 » long» ru_nvcsw; | 44 long ru_nivcsw; |
46 » long» ru_nivcsw; | 45 /* room for more... */ |
47 » /* room for more... */ | 46 long __reserved[16]; |
48 » long __reserved[16]; | |
49 }; | 47 }; |
50 | 48 |
51 int getrlimit (int, struct rlimit *); | 49 int getrlimit(int, struct rlimit*); |
52 int setrlimit (int, const struct rlimit *); | 50 int setrlimit(int, const struct rlimit*); |
53 int getrusage (int, struct rusage *); | 51 int getrusage(int, struct rusage*); |
54 | 52 |
55 int getpriority (int, id_t); | 53 int getpriority(int, id_t); |
56 int setpriority (int, id_t, int); | 54 int setpriority(int, id_t, int); |
57 | 55 |
58 #ifdef _GNU_SOURCE | 56 #ifdef _GNU_SOURCE |
59 int prlimit(pid_t, int, const struct rlimit *, struct rlimit *); | 57 int prlimit(pid_t, int, const struct rlimit*, struct rlimit*); |
60 #define prlimit64 prlimit | 58 #define prlimit64 prlimit |
61 #endif | 59 #endif |
62 | 60 |
63 #define PRIO_MIN (-20) | 61 #define PRIO_MIN (-20) |
64 #define PRIO_MAX 20 | 62 #define PRIO_MAX 20 |
65 | 63 |
66 #define PRIO_PROCESS 0 | 64 #define PRIO_PROCESS 0 |
67 #define PRIO_PGRP 1 | 65 #define PRIO_PGRP 1 |
68 #define PRIO_USER 2 | 66 #define PRIO_USER 2 |
69 | 67 |
70 #define RUSAGE_SELF 0 | 68 #define RUSAGE_SELF 0 |
71 #define RUSAGE_CHILDREN 1 | 69 #define RUSAGE_CHILDREN 1 |
72 | 70 |
73 #define RLIM_INFINITY (~0ULL) | 71 #define RLIM_INFINITY (~0ULL) |
74 #define RLIM_SAVED_CUR RLIM_INFINITY | 72 #define RLIM_SAVED_CUR RLIM_INFINITY |
75 #define RLIM_SAVED_MAX RLIM_INFINITY | 73 #define RLIM_SAVED_MAX RLIM_INFINITY |
76 | 74 |
77 #define RLIMIT_CPU 0 | 75 #define RLIMIT_CPU 0 |
78 #define RLIMIT_FSIZE 1 | 76 #define RLIMIT_FSIZE 1 |
79 #define RLIMIT_DATA 2 | 77 #define RLIMIT_DATA 2 |
80 #define RLIMIT_STACK 3 | 78 #define RLIMIT_STACK 3 |
81 #define RLIMIT_CORE 4 | 79 #define RLIMIT_CORE 4 |
82 #ifndef RLIMIT_RSS | 80 #ifndef RLIMIT_RSS |
83 #define RLIMIT_RSS 5 | 81 #define RLIMIT_RSS 5 |
84 #define RLIMIT_NPROC 6 | 82 #define RLIMIT_NPROC 6 |
85 #define RLIMIT_NOFILE 7 | 83 #define RLIMIT_NOFILE 7 |
86 #define RLIMIT_MEMLOCK 8 | 84 #define RLIMIT_MEMLOCK 8 |
87 #define RLIMIT_AS 9 | 85 #define RLIMIT_AS 9 |
88 #endif | 86 #endif |
89 #define RLIMIT_LOCKS 10 | 87 #define RLIMIT_LOCKS 10 |
90 #define RLIMIT_SIGPENDING 11 | 88 #define RLIMIT_SIGPENDING 11 |
91 #define RLIMIT_MSGQUEUE 12 | 89 #define RLIMIT_MSGQUEUE 12 |
92 #define RLIMIT_NICE 13 | 90 #define RLIMIT_NICE 13 |
93 #define RLIMIT_RTPRIO 14 | 91 #define RLIMIT_RTPRIO 14 |
94 #define RLIMIT_NLIMITS 15 | 92 #define RLIMIT_NLIMITS 15 |
95 | 93 |
96 #define RLIM_NLIMITS RLIMIT_NLIMITS | 94 #define RLIM_NLIMITS RLIMIT_NLIMITS |
97 | 95 |
98 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) | 96 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) |
99 #define RLIM64_INFINITY RLIM_INFINITY | 97 #define RLIM64_INFINITY RLIM_INFINITY |
100 #define RLIM64_SAVED_CUR RLIM_SAVED_CUR | 98 #define RLIM64_SAVED_CUR RLIM_SAVED_CUR |
101 #define RLIM64_SAVED_MAX RLIM_SAVED_MAX | 99 #define RLIM64_SAVED_MAX RLIM_SAVED_MAX |
102 #define getrlimit64 getrlimit | 100 #define getrlimit64 getrlimit |
103 #define setrlimit64 setrlimit | 101 #define setrlimit64 setrlimit |
104 #define rlimit64 rlimit | 102 #define rlimit64 rlimit |
105 #define rlim64_t rlim_t | 103 #define rlim64_t rlim_t |
106 #endif | 104 #endif |
107 | 105 |
108 #ifdef __cplusplus | 106 #ifdef __cplusplus |
109 } | 107 } |
110 #endif | 108 #endif |
111 | 109 |
112 #endif | 110 #endif |
OLD | NEW |