1#![allow(
2 clippy::assertions_on_constants,
3 clippy::absurd_extreme_comparisons,
4 clippy::cast_possible_truncation,
5 unused_comparisons
6)]
7
8#[cfg(any(
9 target_os = "fuchsia",
10 any(target_os = "macos", target_os = "ios"),
11 any(target_os = "freebsd", target_os = "dragonfly"),
12 target_os = "netbsd",
13 target_os = "haiku",
14 target_os = "android",
15 target_os = "emscripten",
16 target_os = "linux",
17 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
18 all(
19 target_os = "linux",
20 any(target_arch = "powerpc", target_arch = "powerpc64")
21 ),
22 all(
23 target_os = "linux",
24 any(target_arch = "sparc", target_arch = "sparc64")
25 ),
26 any(target_os = "solaris", target_os = "illumos"),
27))]
28pub const RLIMIT_AS: u8 = libc::RLIMIT_AS as u8;
29
30#[cfg(not(any(
31 target_os = "fuchsia",
32 any(target_os = "macos", target_os = "ios"),
33 any(target_os = "freebsd", target_os = "dragonfly"),
34 target_os = "netbsd",
35 target_os = "haiku",
36 target_os = "android",
37 target_os = "emscripten",
38 target_os = "linux",
39 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
40 all(
41 target_os = "linux",
42 any(target_arch = "powerpc", target_arch = "powerpc64")
43 ),
44 all(
45 target_os = "linux",
46 any(target_arch = "sparc", target_arch = "sparc64")
47 ),
48 any(target_os = "solaris", target_os = "illumos"),
49)))]
50pub const RLIMIT_AS: u8 = u8::MAX;
51
52#[cfg(any(
55 target_os = "fuchsia",
56 any(target_os = "macos", target_os = "ios"),
57 any(target_os = "freebsd", target_os = "dragonfly"),
58 any(target_os = "openbsd", target_os = "netbsd"),
59 target_os = "haiku",
60 target_os = "android",
61 target_os = "emscripten",
62 target_os = "linux",
63 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
64 all(
65 target_os = "linux",
66 any(target_arch = "powerpc", target_arch = "powerpc64")
67 ),
68 all(
69 target_os = "linux",
70 any(target_arch = "sparc", target_arch = "sparc64")
71 ),
72 any(target_os = "solaris", target_os = "illumos"),
73))]
74pub const RLIMIT_CORE: u8 = libc::RLIMIT_CORE as u8;
75
76#[cfg(not(any(
77 target_os = "fuchsia",
78 any(target_os = "macos", target_os = "ios"),
79 any(target_os = "freebsd", target_os = "dragonfly"),
80 any(target_os = "openbsd", target_os = "netbsd"),
81 target_os = "haiku",
82 target_os = "android",
83 target_os = "emscripten",
84 target_os = "linux",
85 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
86 all(
87 target_os = "linux",
88 any(target_arch = "powerpc", target_arch = "powerpc64")
89 ),
90 all(
91 target_os = "linux",
92 any(target_arch = "sparc", target_arch = "sparc64")
93 ),
94 any(target_os = "solaris", target_os = "illumos"),
95)))]
96pub const RLIMIT_CORE: u8 = u8::MAX;
97
98#[cfg(any(
101 target_os = "fuchsia",
102 any(target_os = "macos", target_os = "ios"),
103 any(target_os = "freebsd", target_os = "dragonfly"),
104 any(target_os = "openbsd", target_os = "netbsd"),
105 target_os = "haiku",
106 target_os = "android",
107 target_os = "emscripten",
108 target_os = "linux",
109 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
110 all(
111 target_os = "linux",
112 any(target_arch = "powerpc", target_arch = "powerpc64")
113 ),
114 all(
115 target_os = "linux",
116 any(target_arch = "sparc", target_arch = "sparc64")
117 ),
118 any(target_os = "solaris", target_os = "illumos"),
119))]
120pub const RLIMIT_CPU: u8 = libc::RLIMIT_CPU as u8;
121
122#[cfg(not(any(
123 target_os = "fuchsia",
124 any(target_os = "macos", target_os = "ios"),
125 any(target_os = "freebsd", target_os = "dragonfly"),
126 any(target_os = "openbsd", target_os = "netbsd"),
127 target_os = "haiku",
128 target_os = "android",
129 target_os = "emscripten",
130 target_os = "linux",
131 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
132 all(
133 target_os = "linux",
134 any(target_arch = "powerpc", target_arch = "powerpc64")
135 ),
136 all(
137 target_os = "linux",
138 any(target_arch = "sparc", target_arch = "sparc64")
139 ),
140 any(target_os = "solaris", target_os = "illumos"),
141)))]
142pub const RLIMIT_CPU: u8 = u8::MAX;
143
144#[cfg(any(
147 target_os = "fuchsia",
148 any(target_os = "macos", target_os = "ios"),
149 any(target_os = "freebsd", target_os = "dragonfly"),
150 any(target_os = "openbsd", target_os = "netbsd"),
151 target_os = "haiku",
152 target_os = "android",
153 target_os = "emscripten",
154 target_os = "linux",
155 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
156 all(
157 target_os = "linux",
158 any(target_arch = "powerpc", target_arch = "powerpc64")
159 ),
160 all(
161 target_os = "linux",
162 any(target_arch = "sparc", target_arch = "sparc64")
163 ),
164 any(target_os = "solaris", target_os = "illumos"),
165))]
166pub const RLIMIT_DATA: u8 = libc::RLIMIT_DATA as u8;
167
168#[cfg(not(any(
169 target_os = "fuchsia",
170 any(target_os = "macos", target_os = "ios"),
171 any(target_os = "freebsd", target_os = "dragonfly"),
172 any(target_os = "openbsd", target_os = "netbsd"),
173 target_os = "haiku",
174 target_os = "android",
175 target_os = "emscripten",
176 target_os = "linux",
177 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
178 all(
179 target_os = "linux",
180 any(target_arch = "powerpc", target_arch = "powerpc64")
181 ),
182 all(
183 target_os = "linux",
184 any(target_arch = "sparc", target_arch = "sparc64")
185 ),
186 any(target_os = "solaris", target_os = "illumos"),
187)))]
188pub const RLIMIT_DATA: u8 = u8::MAX;
189
190#[cfg(any(
193 target_os = "fuchsia",
194 any(target_os = "macos", target_os = "ios"),
195 any(target_os = "freebsd", target_os = "dragonfly"),
196 any(target_os = "openbsd", target_os = "netbsd"),
197 target_os = "haiku",
198 target_os = "android",
199 target_os = "emscripten",
200 target_os = "linux",
201 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
202 all(
203 target_os = "linux",
204 any(target_arch = "powerpc", target_arch = "powerpc64")
205 ),
206 all(
207 target_os = "linux",
208 any(target_arch = "sparc", target_arch = "sparc64")
209 ),
210 any(target_os = "solaris", target_os = "illumos"),
211))]
212pub const RLIMIT_FSIZE: u8 = libc::RLIMIT_FSIZE as u8;
213
214#[cfg(not(any(
215 target_os = "fuchsia",
216 any(target_os = "macos", target_os = "ios"),
217 any(target_os = "freebsd", target_os = "dragonfly"),
218 any(target_os = "openbsd", target_os = "netbsd"),
219 target_os = "haiku",
220 target_os = "android",
221 target_os = "emscripten",
222 target_os = "linux",
223 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
224 all(
225 target_os = "linux",
226 any(target_arch = "powerpc", target_arch = "powerpc64")
227 ),
228 all(
229 target_os = "linux",
230 any(target_arch = "sparc", target_arch = "sparc64")
231 ),
232 any(target_os = "solaris", target_os = "illumos"),
233)))]
234pub const RLIMIT_FSIZE: u8 = u8::MAX;
235
236#[cfg(any(target_os = "freebsd",))]
239pub const RLIMIT_KQUEUES: u8 = libc::RLIMIT_KQUEUES as u8;
240
241#[cfg(not(any(target_os = "freebsd",)))]
242pub const RLIMIT_KQUEUES: u8 = u8::MAX;
243
244#[cfg(any(
247 target_os = "fuchsia",
248 target_os = "android",
249 target_os = "emscripten",
250 target_os = "linux",
251 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
252 all(
253 target_os = "linux",
254 any(target_arch = "powerpc", target_arch = "powerpc64")
255 ),
256 all(
257 target_os = "linux",
258 any(target_arch = "sparc", target_arch = "sparc64")
259 ),
260))]
261pub const RLIMIT_LOCKS: u8 = libc::RLIMIT_LOCKS as u8;
262
263#[cfg(not(any(
264 target_os = "fuchsia",
265 target_os = "android",
266 target_os = "emscripten",
267 target_os = "linux",
268 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
269 all(
270 target_os = "linux",
271 any(target_arch = "powerpc", target_arch = "powerpc64")
272 ),
273 all(
274 target_os = "linux",
275 any(target_arch = "sparc", target_arch = "sparc64")
276 ),
277)))]
278pub const RLIMIT_LOCKS: u8 = u8::MAX;
279
280#[cfg(any(
283 target_os = "fuchsia",
284 any(target_os = "macos", target_os = "ios"),
285 any(target_os = "freebsd", target_os = "dragonfly"),
286 any(target_os = "openbsd", target_os = "netbsd"),
287 target_os = "android",
288 target_os = "emscripten",
289 target_os = "linux",
290 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
291 all(
292 target_os = "linux",
293 any(target_arch = "powerpc", target_arch = "powerpc64")
294 ),
295 all(
296 target_os = "linux",
297 any(target_arch = "sparc", target_arch = "sparc64")
298 ),
299))]
300pub const RLIMIT_MEMLOCK: u8 = libc::RLIMIT_MEMLOCK as u8;
301
302#[cfg(not(any(
303 target_os = "fuchsia",
304 any(target_os = "macos", target_os = "ios"),
305 any(target_os = "freebsd", target_os = "dragonfly"),
306 any(target_os = "openbsd", target_os = "netbsd"),
307 target_os = "android",
308 target_os = "emscripten",
309 target_os = "linux",
310 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
311 all(
312 target_os = "linux",
313 any(target_arch = "powerpc", target_arch = "powerpc64")
314 ),
315 all(
316 target_os = "linux",
317 any(target_arch = "sparc", target_arch = "sparc64")
318 ),
319)))]
320pub const RLIMIT_MEMLOCK: u8 = u8::MAX;
321
322#[cfg(any(
325 target_os = "fuchsia",
326 target_os = "android",
327 target_os = "emscripten",
328 target_os = "linux",
329 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
330 all(
331 target_os = "linux",
332 any(target_arch = "powerpc", target_arch = "powerpc64")
333 ),
334 all(
335 target_os = "linux",
336 any(target_arch = "sparc", target_arch = "sparc64")
337 ),
338))]
339pub const RLIMIT_MSGQUEUE: u8 = libc::RLIMIT_MSGQUEUE as u8;
340
341#[cfg(not(any(
342 target_os = "fuchsia",
343 target_os = "android",
344 target_os = "emscripten",
345 target_os = "linux",
346 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
347 all(
348 target_os = "linux",
349 any(target_arch = "powerpc", target_arch = "powerpc64")
350 ),
351 all(
352 target_os = "linux",
353 any(target_arch = "sparc", target_arch = "sparc64")
354 ),
355)))]
356pub const RLIMIT_MSGQUEUE: u8 = u8::MAX;
357
358#[cfg(any(
361 target_os = "fuchsia",
362 target_os = "android",
363 target_os = "emscripten",
364 target_os = "linux",
365 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
366 all(
367 target_os = "linux",
368 any(target_arch = "powerpc", target_arch = "powerpc64")
369 ),
370 all(
371 target_os = "linux",
372 any(target_arch = "sparc", target_arch = "sparc64")
373 ),
374))]
375pub const RLIMIT_NICE: u8 = libc::RLIMIT_NICE as u8;
376
377#[cfg(not(any(
378 target_os = "fuchsia",
379 target_os = "android",
380 target_os = "emscripten",
381 target_os = "linux",
382 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
383 all(
384 target_os = "linux",
385 any(target_arch = "powerpc", target_arch = "powerpc64")
386 ),
387 all(
388 target_os = "linux",
389 any(target_arch = "sparc", target_arch = "sparc64")
390 ),
391)))]
392pub const RLIMIT_NICE: u8 = u8::MAX;
393
394#[cfg(any(
397 target_os = "fuchsia",
398 any(target_os = "macos", target_os = "ios"),
399 any(target_os = "freebsd", target_os = "dragonfly"),
400 any(target_os = "openbsd", target_os = "netbsd"),
401 target_os = "haiku",
402 target_os = "android",
403 target_os = "emscripten",
404 target_os = "linux",
405 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
406 all(
407 target_os = "linux",
408 any(target_arch = "powerpc", target_arch = "powerpc64")
409 ),
410 all(
411 target_os = "linux",
412 any(target_arch = "sparc", target_arch = "sparc64")
413 ),
414 any(target_os = "solaris", target_os = "illumos"),
415))]
416pub const RLIMIT_NOFILE: u8 = libc::RLIMIT_NOFILE as u8;
417
418#[cfg(not(any(
419 target_os = "fuchsia",
420 any(target_os = "macos", target_os = "ios"),
421 any(target_os = "freebsd", target_os = "dragonfly"),
422 any(target_os = "openbsd", target_os = "netbsd"),
423 target_os = "haiku",
424 target_os = "android",
425 target_os = "emscripten",
426 target_os = "linux",
427 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
428 all(
429 target_os = "linux",
430 any(target_arch = "powerpc", target_arch = "powerpc64")
431 ),
432 all(
433 target_os = "linux",
434 any(target_arch = "sparc", target_arch = "sparc64")
435 ),
436 any(target_os = "solaris", target_os = "illumos"),
437)))]
438pub const RLIMIT_NOFILE: u8 = u8::MAX;
439
440#[cfg(any(target_os = "haiku",))]
443pub const RLIMIT_NOVMON: u8 = libc::RLIMIT_NOVMON as u8;
444
445#[cfg(not(any(target_os = "haiku",)))]
446pub const RLIMIT_NOVMON: u8 = u8::MAX;
447
448#[cfg(any(
451 target_os = "fuchsia",
452 any(target_os = "macos", target_os = "ios"),
453 any(target_os = "freebsd", target_os = "dragonfly"),
454 any(target_os = "openbsd", target_os = "netbsd"),
455 target_os = "android",
456 target_os = "emscripten",
457 target_os = "linux",
458 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
459 all(
460 target_os = "linux",
461 any(target_arch = "powerpc", target_arch = "powerpc64")
462 ),
463 all(
464 target_os = "linux",
465 any(target_arch = "sparc", target_arch = "sparc64")
466 ),
467))]
468pub const RLIMIT_NPROC: u8 = libc::RLIMIT_NPROC as u8;
469
470#[cfg(not(any(
471 target_os = "fuchsia",
472 any(target_os = "macos", target_os = "ios"),
473 any(target_os = "freebsd", target_os = "dragonfly"),
474 any(target_os = "openbsd", target_os = "netbsd"),
475 target_os = "android",
476 target_os = "emscripten",
477 target_os = "linux",
478 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
479 all(
480 target_os = "linux",
481 any(target_arch = "powerpc", target_arch = "powerpc64")
482 ),
483 all(
484 target_os = "linux",
485 any(target_arch = "sparc", target_arch = "sparc64")
486 ),
487)))]
488pub const RLIMIT_NPROC: u8 = u8::MAX;
489
490#[cfg(any(target_os = "freebsd",))]
493pub const RLIMIT_NPTS: u8 = libc::RLIMIT_NPTS as u8;
494
495#[cfg(not(any(target_os = "freebsd",)))]
496pub const RLIMIT_NPTS: u8 = u8::MAX;
497
498#[cfg(any(target_os = "netbsd",))]
501pub const RLIMIT_NTHR: u8 = libc::RLIMIT_NTHR as u8;
502
503#[cfg(not(any(target_os = "netbsd",)))]
504pub const RLIMIT_NTHR: u8 = u8::MAX;
505
506#[cfg(any(target_os = "dragonfly",))]
509pub const RLIMIT_POSIXLOCKS: u8 = libc::RLIMIT_POSIXLOCKS as u8;
510
511#[cfg(not(any(target_os = "dragonfly",)))]
512pub const RLIMIT_POSIXLOCKS: u8 = u8::MAX;
513
514#[cfg(any(
517 target_os = "fuchsia",
518 any(target_os = "macos", target_os = "ios"),
519 any(target_os = "freebsd", target_os = "dragonfly"),
520 any(target_os = "openbsd", target_os = "netbsd"),
521 target_os = "android",
522 target_os = "emscripten",
523 target_os = "linux",
524 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
525 all(
526 target_os = "linux",
527 any(target_arch = "powerpc", target_arch = "powerpc64")
528 ),
529 all(
530 target_os = "linux",
531 any(target_arch = "sparc", target_arch = "sparc64")
532 ),
533))]
534pub const RLIMIT_RSS: u8 = libc::RLIMIT_RSS as u8;
535
536#[cfg(not(any(
537 target_os = "fuchsia",
538 any(target_os = "macos", target_os = "ios"),
539 any(target_os = "freebsd", target_os = "dragonfly"),
540 any(target_os = "openbsd", target_os = "netbsd"),
541 target_os = "android",
542 target_os = "emscripten",
543 target_os = "linux",
544 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
545 all(
546 target_os = "linux",
547 any(target_arch = "powerpc", target_arch = "powerpc64")
548 ),
549 all(
550 target_os = "linux",
551 any(target_arch = "sparc", target_arch = "sparc64")
552 ),
553)))]
554pub const RLIMIT_RSS: u8 = u8::MAX;
555
556#[cfg(any(
559 target_os = "fuchsia",
560 target_os = "android",
561 target_os = "emscripten",
562 target_os = "linux",
563 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
564 all(
565 target_os = "linux",
566 any(target_arch = "powerpc", target_arch = "powerpc64")
567 ),
568 all(
569 target_os = "linux",
570 any(target_arch = "sparc", target_arch = "sparc64")
571 ),
572))]
573pub const RLIMIT_RTPRIO: u8 = libc::RLIMIT_RTPRIO as u8;
574
575#[cfg(not(any(
576 target_os = "fuchsia",
577 target_os = "android",
578 target_os = "emscripten",
579 target_os = "linux",
580 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
581 all(
582 target_os = "linux",
583 any(target_arch = "powerpc", target_arch = "powerpc64")
584 ),
585 all(
586 target_os = "linux",
587 any(target_arch = "sparc", target_arch = "sparc64")
588 ),
589)))]
590pub const RLIMIT_RTPRIO: u8 = u8::MAX;
591
592#[cfg(any(
595 target_os = "fuchsia",
596 target_os = "linux",
597 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
598 all(
599 target_os = "linux",
600 any(target_arch = "powerpc", target_arch = "powerpc64")
601 ),
602 all(
603 target_os = "linux",
604 any(target_arch = "sparc", target_arch = "sparc64")
605 ),
606))]
607pub const RLIMIT_RTTIME: u8 = libc::RLIMIT_RTTIME as u8;
608
609#[cfg(not(any(
610 target_os = "fuchsia",
611 target_os = "linux",
612 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
613 all(
614 target_os = "linux",
615 any(target_arch = "powerpc", target_arch = "powerpc64")
616 ),
617 all(
618 target_os = "linux",
619 any(target_arch = "sparc", target_arch = "sparc64")
620 ),
621)))]
622pub const RLIMIT_RTTIME: u8 = u8::MAX;
623
624#[cfg(any(
627 any(target_os = "freebsd", target_os = "dragonfly"),
628 target_os = "netbsd",
629))]
630pub const RLIMIT_SBSIZE: u8 = libc::RLIMIT_SBSIZE as u8;
631
632#[cfg(not(any(
633 any(target_os = "freebsd", target_os = "dragonfly"),
634 target_os = "netbsd",
635)))]
636pub const RLIMIT_SBSIZE: u8 = u8::MAX;
637
638#[cfg(any(
641 target_os = "fuchsia",
642 target_os = "android",
643 target_os = "emscripten",
644 target_os = "linux",
645 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
646 all(
647 target_os = "linux",
648 any(target_arch = "powerpc", target_arch = "powerpc64")
649 ),
650 all(
651 target_os = "linux",
652 any(target_arch = "sparc", target_arch = "sparc64")
653 ),
654))]
655pub const RLIMIT_SIGPENDING: u8 = libc::RLIMIT_SIGPENDING as u8;
656
657#[cfg(not(any(
658 target_os = "fuchsia",
659 target_os = "android",
660 target_os = "emscripten",
661 target_os = "linux",
662 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
663 all(
664 target_os = "linux",
665 any(target_arch = "powerpc", target_arch = "powerpc64")
666 ),
667 all(
668 target_os = "linux",
669 any(target_arch = "sparc", target_arch = "sparc64")
670 ),
671)))]
672pub const RLIMIT_SIGPENDING: u8 = u8::MAX;
673
674#[cfg(any(
677 target_os = "fuchsia",
678 any(target_os = "macos", target_os = "ios"),
679 any(target_os = "freebsd", target_os = "dragonfly"),
680 any(target_os = "openbsd", target_os = "netbsd"),
681 target_os = "haiku",
682 target_os = "android",
683 target_os = "emscripten",
684 target_os = "linux",
685 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
686 all(
687 target_os = "linux",
688 any(target_arch = "powerpc", target_arch = "powerpc64")
689 ),
690 all(
691 target_os = "linux",
692 any(target_arch = "sparc", target_arch = "sparc64")
693 ),
694 any(target_os = "solaris", target_os = "illumos"),
695))]
696pub const RLIMIT_STACK: u8 = libc::RLIMIT_STACK as u8;
697
698#[cfg(not(any(
699 target_os = "fuchsia",
700 any(target_os = "macos", target_os = "ios"),
701 any(target_os = "freebsd", target_os = "dragonfly"),
702 any(target_os = "openbsd", target_os = "netbsd"),
703 target_os = "haiku",
704 target_os = "android",
705 target_os = "emscripten",
706 target_os = "linux",
707 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
708 all(
709 target_os = "linux",
710 any(target_arch = "powerpc", target_arch = "powerpc64")
711 ),
712 all(
713 target_os = "linux",
714 any(target_arch = "sparc", target_arch = "sparc64")
715 ),
716 any(target_os = "solaris", target_os = "illumos"),
717)))]
718pub const RLIMIT_STACK: u8 = u8::MAX;
719
720#[cfg(any(target_os = "freebsd",))]
723pub const RLIMIT_SWAP: u8 = libc::RLIMIT_SWAP as u8;
724
725#[cfg(not(any(target_os = "freebsd",)))]
726pub const RLIMIT_SWAP: u8 = u8::MAX;
727
728#[cfg(any(target_os = "freebsd",))]
731pub const RLIMIT_UMTXP: u8 = libc::RLIMIT_UMTXP as u8;
732
733#[cfg(not(any(target_os = "freebsd",)))]
734pub const RLIMIT_UMTXP: u8 = u8::MAX;
735
736#[cfg(any(
739 any(target_os = "freebsd", target_os = "dragonfly"),
740 any(target_os = "solaris", target_os = "illumos"),
741))]
742pub const RLIMIT_VMEM: u8 = libc::RLIMIT_VMEM as u8;
743
744#[cfg(not(any(
745 any(target_os = "freebsd", target_os = "dragonfly"),
746 any(target_os = "solaris", target_os = "illumos"),
747)))]
748pub const RLIMIT_VMEM: u8 = u8::MAX;
749
750#[allow(clippy::too_many_lines)]
753#[test]
754fn resource_bound() {
755 #[cfg(any(
756 target_os = "fuchsia",
757 any(target_os = "macos", target_os = "ios"),
758 any(target_os = "freebsd", target_os = "dragonfly"),
759 target_os = "netbsd",
760 target_os = "haiku",
761 target_os = "android",
762 target_os = "emscripten",
763 target_os = "linux",
764 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
765 all(
766 target_os = "linux",
767 any(target_arch = "powerpc", target_arch = "powerpc64")
768 ),
769 all(
770 target_os = "linux",
771 any(target_arch = "sparc", target_arch = "sparc64")
772 ),
773 any(target_os = "solaris", target_os = "illumos"),
774 ))]
775 assert!((0..128).contains(&libc::RLIMIT_AS));
776
777 #[cfg(any(
778 target_os = "fuchsia",
779 any(target_os = "macos", target_os = "ios"),
780 any(target_os = "freebsd", target_os = "dragonfly"),
781 any(target_os = "openbsd", target_os = "netbsd"),
782 target_os = "haiku",
783 target_os = "android",
784 target_os = "emscripten",
785 target_os = "linux",
786 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
787 all(
788 target_os = "linux",
789 any(target_arch = "powerpc", target_arch = "powerpc64")
790 ),
791 all(
792 target_os = "linux",
793 any(target_arch = "sparc", target_arch = "sparc64")
794 ),
795 any(target_os = "solaris", target_os = "illumos"),
796 ))]
797 assert!((0..128).contains(&libc::RLIMIT_CORE));
798
799 #[cfg(any(
800 target_os = "fuchsia",
801 any(target_os = "macos", target_os = "ios"),
802 any(target_os = "freebsd", target_os = "dragonfly"),
803 any(target_os = "openbsd", target_os = "netbsd"),
804 target_os = "haiku",
805 target_os = "android",
806 target_os = "emscripten",
807 target_os = "linux",
808 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
809 all(
810 target_os = "linux",
811 any(target_arch = "powerpc", target_arch = "powerpc64")
812 ),
813 all(
814 target_os = "linux",
815 any(target_arch = "sparc", target_arch = "sparc64")
816 ),
817 any(target_os = "solaris", target_os = "illumos"),
818 ))]
819 assert!((0..128).contains(&libc::RLIMIT_CPU));
820
821 #[cfg(any(
822 target_os = "fuchsia",
823 any(target_os = "macos", target_os = "ios"),
824 any(target_os = "freebsd", target_os = "dragonfly"),
825 any(target_os = "openbsd", target_os = "netbsd"),
826 target_os = "haiku",
827 target_os = "android",
828 target_os = "emscripten",
829 target_os = "linux",
830 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
831 all(
832 target_os = "linux",
833 any(target_arch = "powerpc", target_arch = "powerpc64")
834 ),
835 all(
836 target_os = "linux",
837 any(target_arch = "sparc", target_arch = "sparc64")
838 ),
839 any(target_os = "solaris", target_os = "illumos"),
840 ))]
841 assert!((0..128).contains(&libc::RLIMIT_DATA));
842
843 #[cfg(any(
844 target_os = "fuchsia",
845 any(target_os = "macos", target_os = "ios"),
846 any(target_os = "freebsd", target_os = "dragonfly"),
847 any(target_os = "openbsd", target_os = "netbsd"),
848 target_os = "haiku",
849 target_os = "android",
850 target_os = "emscripten",
851 target_os = "linux",
852 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
853 all(
854 target_os = "linux",
855 any(target_arch = "powerpc", target_arch = "powerpc64")
856 ),
857 all(
858 target_os = "linux",
859 any(target_arch = "sparc", target_arch = "sparc64")
860 ),
861 any(target_os = "solaris", target_os = "illumos"),
862 ))]
863 assert!((0..128).contains(&libc::RLIMIT_FSIZE));
864
865 #[cfg(any(target_os = "freebsd",))]
866 assert!((0..128).contains(&libc::RLIMIT_KQUEUES));
867
868 #[cfg(any(
869 target_os = "fuchsia",
870 target_os = "android",
871 target_os = "emscripten",
872 target_os = "linux",
873 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
874 all(
875 target_os = "linux",
876 any(target_arch = "powerpc", target_arch = "powerpc64")
877 ),
878 all(
879 target_os = "linux",
880 any(target_arch = "sparc", target_arch = "sparc64")
881 ),
882 ))]
883 assert!((0..128).contains(&libc::RLIMIT_LOCKS));
884
885 #[cfg(any(
886 target_os = "fuchsia",
887 any(target_os = "macos", target_os = "ios"),
888 any(target_os = "freebsd", target_os = "dragonfly"),
889 any(target_os = "openbsd", target_os = "netbsd"),
890 target_os = "android",
891 target_os = "emscripten",
892 target_os = "linux",
893 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
894 all(
895 target_os = "linux",
896 any(target_arch = "powerpc", target_arch = "powerpc64")
897 ),
898 all(
899 target_os = "linux",
900 any(target_arch = "sparc", target_arch = "sparc64")
901 ),
902 ))]
903 assert!((0..128).contains(&libc::RLIMIT_MEMLOCK));
904
905 #[cfg(any(
906 target_os = "fuchsia",
907 target_os = "android",
908 target_os = "emscripten",
909 target_os = "linux",
910 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
911 all(
912 target_os = "linux",
913 any(target_arch = "powerpc", target_arch = "powerpc64")
914 ),
915 all(
916 target_os = "linux",
917 any(target_arch = "sparc", target_arch = "sparc64")
918 ),
919 ))]
920 assert!((0..128).contains(&libc::RLIMIT_MSGQUEUE));
921
922 #[cfg(any(
923 target_os = "fuchsia",
924 target_os = "android",
925 target_os = "emscripten",
926 target_os = "linux",
927 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
928 all(
929 target_os = "linux",
930 any(target_arch = "powerpc", target_arch = "powerpc64")
931 ),
932 all(
933 target_os = "linux",
934 any(target_arch = "sparc", target_arch = "sparc64")
935 ),
936 ))]
937 assert!((0..128).contains(&libc::RLIMIT_NICE));
938
939 #[cfg(any(
940 target_os = "fuchsia",
941 any(target_os = "macos", target_os = "ios"),
942 any(target_os = "freebsd", target_os = "dragonfly"),
943 any(target_os = "openbsd", target_os = "netbsd"),
944 target_os = "haiku",
945 target_os = "android",
946 target_os = "emscripten",
947 target_os = "linux",
948 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
949 all(
950 target_os = "linux",
951 any(target_arch = "powerpc", target_arch = "powerpc64")
952 ),
953 all(
954 target_os = "linux",
955 any(target_arch = "sparc", target_arch = "sparc64")
956 ),
957 any(target_os = "solaris", target_os = "illumos"),
958 ))]
959 assert!((0..128).contains(&libc::RLIMIT_NOFILE));
960
961 #[cfg(any(target_os = "haiku",))]
962 assert!((0..128).contains(&libc::RLIMIT_NOVMON));
963
964 #[cfg(any(
965 target_os = "fuchsia",
966 any(target_os = "macos", target_os = "ios"),
967 any(target_os = "freebsd", target_os = "dragonfly"),
968 any(target_os = "openbsd", target_os = "netbsd"),
969 target_os = "android",
970 target_os = "emscripten",
971 target_os = "linux",
972 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
973 all(
974 target_os = "linux",
975 any(target_arch = "powerpc", target_arch = "powerpc64")
976 ),
977 all(
978 target_os = "linux",
979 any(target_arch = "sparc", target_arch = "sparc64")
980 ),
981 ))]
982 assert!((0..128).contains(&libc::RLIMIT_NPROC));
983
984 #[cfg(any(target_os = "freebsd",))]
985 assert!((0..128).contains(&libc::RLIMIT_NPTS));
986
987 #[cfg(any(target_os = "netbsd",))]
988 assert!((0..128).contains(&libc::RLIMIT_NTHR));
989
990 #[cfg(any(target_os = "dragonfly",))]
991 assert!((0..128).contains(&libc::RLIMIT_POSIXLOCKS));
992
993 #[cfg(any(
994 target_os = "fuchsia",
995 any(target_os = "macos", target_os = "ios"),
996 any(target_os = "freebsd", target_os = "dragonfly"),
997 any(target_os = "openbsd", target_os = "netbsd"),
998 target_os = "android",
999 target_os = "emscripten",
1000 target_os = "linux",
1001 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1002 all(
1003 target_os = "linux",
1004 any(target_arch = "powerpc", target_arch = "powerpc64")
1005 ),
1006 all(
1007 target_os = "linux",
1008 any(target_arch = "sparc", target_arch = "sparc64")
1009 ),
1010 ))]
1011 assert!((0..128).contains(&libc::RLIMIT_RSS));
1012
1013 #[cfg(any(
1014 target_os = "fuchsia",
1015 target_os = "android",
1016 target_os = "emscripten",
1017 target_os = "linux",
1018 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1019 all(
1020 target_os = "linux",
1021 any(target_arch = "powerpc", target_arch = "powerpc64")
1022 ),
1023 all(
1024 target_os = "linux",
1025 any(target_arch = "sparc", target_arch = "sparc64")
1026 ),
1027 ))]
1028 assert!((0..128).contains(&libc::RLIMIT_RTPRIO));
1029
1030 #[cfg(any(
1031 target_os = "fuchsia",
1032 target_os = "linux",
1033 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1034 all(
1035 target_os = "linux",
1036 any(target_arch = "powerpc", target_arch = "powerpc64")
1037 ),
1038 all(
1039 target_os = "linux",
1040 any(target_arch = "sparc", target_arch = "sparc64")
1041 ),
1042 ))]
1043 assert!((0..128).contains(&libc::RLIMIT_RTTIME));
1044
1045 #[cfg(any(
1046 any(target_os = "freebsd", target_os = "dragonfly"),
1047 target_os = "netbsd",
1048 ))]
1049 assert!((0..128).contains(&libc::RLIMIT_SBSIZE));
1050
1051 #[cfg(any(
1052 target_os = "fuchsia",
1053 target_os = "android",
1054 target_os = "emscripten",
1055 target_os = "linux",
1056 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1057 all(
1058 target_os = "linux",
1059 any(target_arch = "powerpc", target_arch = "powerpc64")
1060 ),
1061 all(
1062 target_os = "linux",
1063 any(target_arch = "sparc", target_arch = "sparc64")
1064 ),
1065 ))]
1066 assert!((0..128).contains(&libc::RLIMIT_SIGPENDING));
1067
1068 #[cfg(any(
1069 target_os = "fuchsia",
1070 any(target_os = "macos", target_os = "ios"),
1071 any(target_os = "freebsd", target_os = "dragonfly"),
1072 any(target_os = "openbsd", target_os = "netbsd"),
1073 target_os = "haiku",
1074 target_os = "android",
1075 target_os = "emscripten",
1076 target_os = "linux",
1077 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1078 all(
1079 target_os = "linux",
1080 any(target_arch = "powerpc", target_arch = "powerpc64")
1081 ),
1082 all(
1083 target_os = "linux",
1084 any(target_arch = "sparc", target_arch = "sparc64")
1085 ),
1086 any(target_os = "solaris", target_os = "illumos"),
1087 ))]
1088 assert!((0..128).contains(&libc::RLIMIT_STACK));
1089
1090 #[cfg(any(target_os = "freebsd",))]
1091 assert!((0..128).contains(&libc::RLIMIT_SWAP));
1092
1093 #[cfg(any(target_os = "freebsd",))]
1094 assert!((0..128).contains(&libc::RLIMIT_UMTXP));
1095
1096 #[cfg(any(
1097 any(target_os = "freebsd", target_os = "dragonfly"),
1098 any(target_os = "solaris", target_os = "illumos"),
1099 ))]
1100 assert!((0..128).contains(&libc::RLIMIT_VMEM));
1101}
1102
1103#[cfg(any(
1104 target_os = "fuchsia",
1105 all(target_os = "android", target_pointer_width = "32"),
1106 all(target_os = "android", target_pointer_width = "64"),
1107 target_os = "emscripten",
1108 target_os = "linux",
1109))]
1110pub use libc::rlimit64 as rlimit;
1111
1112#[cfg(all(
1113 not(any(
1114 target_os = "fuchsia",
1115 all(target_os = "android", target_pointer_width = "32"),
1116 all(target_os = "android", target_pointer_width = "64"),
1117 target_os = "emscripten",
1118 target_os = "linux",
1119 )),
1120 any(
1121 target_os = "fuchsia",
1122 all(target_os = "android", target_pointer_width = "32"),
1123 all(target_os = "android", target_pointer_width = "64"),
1124 target_os = "emscripten",
1125 target_os = "linux",
1126 target_family = "unix",
1127 target_os = "vxworks",
1128 )
1129))]
1130pub use libc::rlimit;
1131
1132#[cfg(any(
1133 target_os = "android",
1134 target_os = "emscripten",
1135 all(target_os = "linux", target_env = "gnu"),
1136 all(target_os = "linux", target_env = "musl"),
1137 all(target_os = "linux", target_env = "uclibc"),
1138))]
1139pub use libc::getrlimit64 as getrlimit;
1140
1141#[cfg(all(
1142 not(any(
1143 target_os = "android",
1144 target_os = "emscripten",
1145 all(target_os = "linux", target_env = "gnu"),
1146 all(target_os = "linux", target_env = "musl"),
1147 all(target_os = "linux", target_env = "uclibc"),
1148 )),
1149 any(
1150 any(
1151 target_os = "macos",
1152 target_os = "ios",
1153 target_os = "watchos",
1154 target_os = "freebsd",
1155 target_os = "dragonfly",
1156 target_os = "openbsd",
1157 target_os = "netbsd"
1158 ),
1159 target_os = "haiku",
1160 target_os = "hermit",
1161 target_os = "android",
1162 target_os = "emscripten",
1163 all(target_os = "linux", target_env = "gnu"),
1164 all(target_os = "linux", target_env = "musl"),
1165 all(target_os = "linux", target_env = "uclibc"),
1166 target_env = "newlib",
1167 target_os = "redox",
1168 any(target_os = "solaris", target_os = "illumos"),
1169 )
1170))]
1171pub use libc::getrlimit;
1172
1173#[cfg(any(
1174 target_os = "android",
1175 target_os = "emscripten",
1176 all(target_os = "linux", target_env = "gnu"),
1177 all(target_os = "linux", target_env = "musl"),
1178 all(target_os = "linux", target_env = "uclibc"),
1179))]
1180pub use libc::setrlimit64 as setrlimit;
1181
1182#[cfg(all(
1183 not(any(
1184 target_os = "android",
1185 target_os = "emscripten",
1186 all(target_os = "linux", target_env = "gnu"),
1187 all(target_os = "linux", target_env = "musl"),
1188 all(target_os = "linux", target_env = "uclibc"),
1189 )),
1190 any(
1191 any(
1192 target_os = "macos",
1193 target_os = "ios",
1194 target_os = "watchos",
1195 target_os = "freebsd",
1196 target_os = "dragonfly",
1197 target_os = "openbsd",
1198 target_os = "netbsd"
1199 ),
1200 target_os = "haiku",
1201 target_os = "hermit",
1202 target_os = "android",
1203 target_os = "emscripten",
1204 all(target_os = "linux", target_env = "gnu"),
1205 all(target_os = "linux", target_env = "musl"),
1206 all(target_os = "linux", target_env = "uclibc"),
1207 target_env = "newlib",
1208 target_os = "redox",
1209 any(target_os = "solaris", target_os = "illumos"),
1210 )
1211))]
1212pub use libc::setrlimit;
1213
1214#[cfg(any(
1215 target_os = "fuchsia",
1216 any(target_os = "macos", target_os = "ios"),
1217 any(target_os = "freebsd", target_os = "dragonfly"),
1218 any(target_os = "openbsd", target_os = "netbsd"),
1219 target_os = "haiku",
1220 target_os = "android",
1221 target_os = "emscripten",
1222 target_os = "linux",
1223 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1224 all(
1225 target_os = "linux",
1226 any(target_arch = "powerpc", target_arch = "powerpc64")
1227 ),
1228 all(
1229 target_os = "linux",
1230 any(target_arch = "sparc", target_arch = "sparc64")
1231 ),
1232 any(target_os = "solaris", target_os = "illumos"),
1233))]
1234pub const RLIM_INFINITY: u64 = libc::RLIM_INFINITY as u64;
1235
1236#[cfg(not(any(
1237 target_os = "fuchsia",
1238 any(target_os = "macos", target_os = "ios"),
1239 any(target_os = "freebsd", target_os = "dragonfly"),
1240 any(target_os = "openbsd", target_os = "netbsd"),
1241 target_os = "haiku",
1242 target_os = "android",
1243 target_os = "emscripten",
1244 target_os = "linux",
1245 all(target_os = "linux", any(target_arch = "mips", target_arch = "mips64")),
1246 all(
1247 target_os = "linux",
1248 any(target_arch = "powerpc", target_arch = "powerpc64")
1249 ),
1250 all(
1251 target_os = "linux",
1252 any(target_arch = "sparc", target_arch = "sparc64")
1253 ),
1254 any(target_os = "solaris", target_os = "illumos"),
1255)))]
1256pub const RLIM_INFINITY: u64 = u64::MAX;