rustix/backend/libc/process/
types.rs1#[cfg(not(any(
2 target_os = "espidf",
3 target_os = "fuchsia",
4 target_os = "horizon",
5 target_os = "redox",
6 target_os = "vita",
7 target_os = "wasi"
8)))]
9use crate::backend::c;
10
11#[cfg(not(any(
18 target_os = "espidf",
19 target_os = "fuchsia",
20 target_os = "horizon",
21 target_os = "redox",
22 target_os = "vita",
23 target_os = "wasi"
24)))]
25#[derive(Copy, Clone, Debug, Eq, PartialEq)]
26#[cfg_attr(not(target_os = "l4re"), repr(u32))]
27#[cfg_attr(target_os = "l4re", repr(u64))]
28#[non_exhaustive]
29pub enum Resource {
30 Cpu = bitcast!(c::RLIMIT_CPU),
32 Fsize = bitcast!(c::RLIMIT_FSIZE),
34 Data = bitcast!(c::RLIMIT_DATA),
36 Stack = bitcast!(c::RLIMIT_STACK),
38 #[cfg(not(target_os = "haiku"))]
40 Core = bitcast!(c::RLIMIT_CORE),
41 #[cfg(not(any(
44 apple,
45 solarish,
46 target_os = "cygwin",
47 target_os = "haiku",
48 target_os = "nto",
49 )))]
50 Rss = bitcast!(c::RLIMIT_RSS),
51 #[cfg(not(any(solarish, target_os = "cygwin", target_os = "haiku")))]
53 Nproc = bitcast!(c::RLIMIT_NPROC),
54 Nofile = bitcast!(c::RLIMIT_NOFILE),
56 #[cfg(not(any(solarish, target_os = "aix", target_os = "cygwin", target_os = "haiku")))]
58 Memlock = bitcast!(c::RLIMIT_MEMLOCK),
59 #[cfg(not(target_os = "openbsd"))]
61 As = bitcast!(c::RLIMIT_AS),
62 #[cfg(not(any(
64 bsd,
65 solarish,
66 target_os = "aix",
67 target_os = "cygwin",
68 target_os = "haiku",
69 target_os = "hurd",
70 target_os = "nto",
71 )))]
72 Locks = bitcast!(c::RLIMIT_LOCKS),
73 #[cfg(not(any(
75 bsd,
76 solarish,
77 target_os = "aix",
78 target_os = "cygwin",
79 target_os = "haiku",
80 target_os = "hurd",
81 target_os = "nto",
82 )))]
83 Sigpending = bitcast!(c::RLIMIT_SIGPENDING),
84 #[cfg(not(any(
86 bsd,
87 solarish,
88 target_os = "aix",
89 target_os = "cygwin",
90 target_os = "haiku",
91 target_os = "hurd",
92 target_os = "nto",
93 )))]
94 Msgqueue = bitcast!(c::RLIMIT_MSGQUEUE),
95 #[cfg(not(any(
97 bsd,
98 solarish,
99 target_os = "aix",
100 target_os = "cygwin",
101 target_os = "haiku",
102 target_os = "hurd",
103 target_os = "nto",
104 )))]
105 Nice = bitcast!(c::RLIMIT_NICE),
106 #[cfg(not(any(
108 bsd,
109 solarish,
110 target_os = "aix",
111 target_os = "cygwin",
112 target_os = "haiku",
113 target_os = "hurd",
114 target_os = "nto",
115 )))]
116 Rtprio = bitcast!(c::RLIMIT_RTPRIO),
117 #[cfg(not(any(
119 bsd,
120 solarish,
121 target_os = "aix",
122 target_os = "android",
123 target_os = "cygwin",
124 target_os = "emscripten",
125 target_os = "haiku",
126 target_os = "hurd",
127 target_os = "nto",
128 )))]
129 Rttime = bitcast!(c::RLIMIT_RTTIME),
130}
131
132#[cfg(apple)]
133#[allow(non_upper_case_globals)]
134impl Resource {
135 pub const Rss: Self = Self::As;
137}
138
139#[cfg(freebsdlike)]
140pub type RawId = c::id_t;