@@ -99,19 +99,33 @@ struct rlimit
99
99
*/
100
100
};
101
101
102
+ /* The X/Open standard defines that all the functions below must use
103
+ `int' as the type for the first argument. When we are compiling with
104
+ GNU extensions we change this slightly to provide better error
105
+ checking. */
106
+ #if defined __USE_GNU && !defined __cplusplus
107
+ typedef enum __rlimit_resource __rlimit_resource_t ;
108
+ typedef enum __rusage_who __rusage_who_t ;
109
+ typedef enum __priority_which __priority_which_t ;
110
+ #else
111
+ typedef int __rlimit_resource_t ;
112
+ typedef int __rusage_who_t ;
113
+ typedef int __priority_which_t ;
114
+ #endif
115
+
102
116
/* Put the soft and hard limits for RESOURCE in *RLIMITS.
103
117
Returns 0 if successful, -1 if not (and sets errno). */
104
- extern int getrlimit (enum __rlimit_resource __resource ,
118
+ extern int getrlimit (__rlimit_resource_t __resource ,
105
119
struct rlimit * __rlimits ) __THROW ;
106
- extern int __getrlimit (enum __rlimit_resource __resource ,
120
+ extern int __getrlimit (__rlimit_resource_t __resource ,
107
121
struct rlimit * __rlimits ) __THROW ;
108
122
109
123
/* Set the soft and hard limits for RESOURCE to *RLIMITS.
110
124
Only the super-user can increase hard limits.
111
125
Return 0 if successful, -1 if not (and sets errno). */
112
- extern int setrlimit (enum __rlimit_resource __resource ,
126
+ extern int setrlimit (__rlimit_resource_t __resource ,
113
127
struct rlimit * __rlimits ) __THROW ;
114
- extern int __setrlimit (enum __rlimit_resource __resource ,
128
+ extern int __setrlimit (__rlimit_resource_t __resource ,
115
129
struct rlimit * __rlimits ) __THROW ;
116
130
117
131
/* Possible values for first argument to `getrusage'. */
@@ -127,9 +141,9 @@ enum __rusage_who
127
141
128
142
/* Return resource usage information on process indicated by WHO
129
143
and put it in *USAGE. Returns 0 for success, -1 for failure. */
130
- extern int getrusage (enum __rusage_who __who ,
144
+ extern int getrusage (__rusage_who_t __who ,
131
145
struct rusage * __usage ) __THROW ;
132
- extern int __getrusage (enum __rusage_who __who ,
146
+ extern int __getrusage (__rusage_who_t __who ,
133
147
struct rusage * __usage ) __THROW ;
134
148
135
149
#if 0
@@ -172,14 +186,14 @@ enum __priority_which
172
186
(see above); if WHO is zero, the current process, process group, or user
173
187
(as specified by WHO) is used. A lower priority number means higher
174
188
priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */
175
- extern int getpriority (enum __priority_which __which , int __who ) __THROW ;
176
- extern int __getpriority (enum __priority_which __which , int __who ) __THROW ;
189
+ extern int getpriority (__priority_which_t __which , int __who ) __THROW ;
190
+ extern int __getpriority (__priority_which_t __which , int __who ) __THROW ;
177
191
178
192
/* Set the priority of all processes specified by WHICH and WHO (see above)
179
193
to PRIO. Returns 0 on success, -1 on errors. */
180
- extern int setpriority (enum __priority_which __which , int __who ,
194
+ extern int setpriority (__priority_which_t __which , int __who ,
181
195
int __prio ) __THROW ;
182
- extern int __setpriority (enum __priority_which __which , int __who ,
196
+ extern int __setpriority (__priority_which_t __which , int __who ,
183
197
int __prio ) __THROW ;
184
198
185
199
/* Increment the priority of the current process by INCREMENT. Return
0 commit comments