@@ -74,7 +74,7 @@ pub struct Process {
74
74
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
75
75
#[ getset( get = "pub" , set = "pub" ) ]
76
76
/// Rlimits specifies rlimit options to apply to the process.
77
- rlimits : Option < Vec < LinuxRlimit > > ,
77
+ rlimits : Option < Vec < PosixRlimit > > ,
78
78
79
79
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
80
80
#[ getset( get_copy = "pub" , set = "pub" ) ]
@@ -141,8 +141,8 @@ impl Default for Process {
141
141
capabilities : Some ( Default :: default ( ) ) ,
142
142
// Sets the default maximum of 1024 files the process can open
143
143
// This is the same as the linux kernel default
144
- rlimits : vec ! [ LinuxRlimit {
145
- typ: LinuxRlimitType :: RlimitNofile ,
144
+ rlimits : vec ! [ PosixRlimit {
145
+ typ: PosixRlimitType :: RlimitNofile ,
146
146
hard: 1024 ,
147
147
soft: 1024 ,
148
148
} ]
@@ -180,63 +180,79 @@ pub struct Box {
180
180
#[ derive( Clone , Copy , Debug , Deserialize , Eq , PartialEq , Serialize ) ]
181
181
#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
182
182
/// Available rlimit types (see <https://man7.org/linux/man-pages/man2/getrlimit.2.html>)
183
- pub enum LinuxRlimitType {
183
+ pub enum PosixRlimitType {
184
184
/// Limit in seconds of the amount of CPU time that the process can consume.
185
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
185
186
RlimitCpu ,
186
187
187
188
/// Maximum size in bytes of the files that the process creates.
189
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
188
190
RlimitFsize ,
189
191
190
192
/// Maximum size of the process's data segment (init data, uninit data and
191
193
/// heap) in bytes.
194
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
192
195
RlimitData ,
193
196
194
197
/// Maximum size of the proces stack in bytes.
198
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
195
199
RlimitStack ,
196
200
197
201
/// Maximum size of a core dump file in bytes.
202
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
198
203
RlimitCore ,
199
204
200
205
/// Limit on the process's resident set (the number of virtual pages
201
206
/// resident in RAM).
207
+ #[ cfg( target_os = "linux" ) ]
202
208
RlimitRss ,
203
209
204
210
/// Limit on number of threads for the real uid calling processes.
211
+ #[ cfg( target_os = "linux" ) ]
205
212
RlimitNproc ,
206
213
207
214
/// One greator than the maximum number of file descritors that one process
208
215
/// may open.
216
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
209
217
RlimitNofile ,
210
218
211
219
/// Maximum number of bytes of memory that may be locked into RAM.
220
+ #[ cfg( target_os = "linux" ) ]
212
221
RlimitMemlock ,
213
222
214
223
/// Maximum size of the process's virtual memory(address space) in bytes.
224
+ #[ cfg( any( target_os = "linux" , target_os = "solaris" ) ) ]
215
225
RlimitAs ,
216
226
217
227
/// Limit on the number of locks and leases for the process.
228
+ #[ cfg( target_os = "linux" ) ]
218
229
RlimitLocks ,
219
230
220
231
/// Limit on number of signals that may be queued for the process.
232
+ #[ cfg( target_os = "linux" ) ]
221
233
RlimitSigpending ,
222
234
223
235
/// Limit on the number of bytes that can be allocated for POSIX message
224
236
/// queue.
237
+ #[ cfg( target_os = "linux" ) ]
225
238
RlimitMsgqueue ,
226
239
227
240
/// Specifies a ceiling to which the process's nice value can be raised.
241
+ #[ cfg( target_os = "linux" ) ]
228
242
RlimitNice ,
229
243
230
244
/// Specifies a ceiling on the real-time priority.
245
+ #[ cfg( target_os = "linux" ) ]
231
246
RlimitRtprio ,
232
247
233
248
/// This is a limit (in microseconds) on the amount of CPU time that a
234
249
/// process scheduled under a real-time scheduling policy may consume
235
250
/// without making a blocking system call.
251
+ #[ cfg( target_os = "linux" ) ]
236
252
RlimitRttime ,
237
253
}
238
254
239
- impl Default for LinuxRlimitType {
255
+ impl Default for PosixRlimitType {
240
256
fn default ( ) -> Self {
241
257
Self :: RlimitCpu
242
258
}
@@ -253,10 +269,10 @@ impl Default for LinuxRlimitType {
253
269
) ]
254
270
#[ getset( get_copy = "pub" , set = "pub" ) ]
255
271
/// RLimit types and restrictions.
256
- pub struct LinuxRlimit {
272
+ pub struct PosixRlimit {
257
273
#[ serde( rename = "type" ) ]
258
274
/// Type of Rlimit to set
259
- typ : LinuxRlimitType ,
275
+ typ : PosixRlimitType ,
260
276
261
277
#[ serde( default ) ]
262
278
/// Hard limit for specified type
0 commit comments