Skip to content

Commit a1ecf7b

Browse files
schctlblt
authored andcommitted
Add NetBSD configuration for supported process resources
1 parent 5514e8b commit a1ecf7b

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/sys/resource.rs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ cfg_if! {
2424
}
2525

2626
libc_enum! {
27+
/// Types of process resources.
28+
///
2729
/// The Resource enum is platform dependent. Check different platform
28-
/// manuals for more details. Some platform links has been provided for
29-
/// earier reference (non-exhaustive).
30+
/// manuals for more details. Some platform links have been provided for
31+
/// easier reference (non-exhaustive).
3032
///
3133
/// * [Linux](https://man7.org/linux/man-pages/man2/getrlimit.2.html)
3234
/// * [FreeBSD](https://www.freebsd.org/cgi/man.cgi?query=setrlimit)
35+
/// * [NetBSD](https://man.netbsd.org/setrlimit.2)
3336
3437
// linux-gnu uses u_int as resource enum, which is implemented in libc as
3538
// well.
@@ -49,11 +52,7 @@ libc_enum! {
4952
), repr(i32))]
5053
#[non_exhaustive]
5154
pub enum Resource {
52-
#[cfg(not(any(
53-
target_os = "freebsd",
54-
target_os = "netbsd",
55-
target_os = "openbsd"
56-
)))]
55+
#[cfg(not(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
5756
#[cfg_attr(docsrs, doc(cfg(all())))]
5857
/// The maximum amount (in bytes) of virtual memory the process is
5958
/// allowed to map.
@@ -83,7 +82,13 @@ libc_enum! {
8382
/// this process may establish.
8483
RLIMIT_LOCKS,
8584

86-
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))]
85+
#[cfg(any(
86+
target_os = "android",
87+
target_os = "freebsd",
88+
target_os = "openbsd",
89+
target_os = "linux",
90+
target_os = "netbsd"
91+
))]
8792
#[cfg_attr(docsrs, doc(cfg(all())))]
8893
/// The maximum size (in bytes) which a process may lock into memory
8994
/// using the mlock(2) system call.
@@ -101,7 +106,13 @@ libc_enum! {
101106
/// setpriority or nice.
102107
RLIMIT_NICE,
103108

104-
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))]
109+
#[cfg(any(
110+
target_os = "android",
111+
target_os = "freebsd",
112+
target_os = "netbsd",
113+
target_os = "openbsd",
114+
target_os = "linux",
115+
))]
105116
#[cfg_attr(docsrs, doc(cfg(all())))]
106117
/// The maximum number of simultaneous processes for this user id.
107118
RLIMIT_NPROC,
@@ -112,7 +123,12 @@ libc_enum! {
112123
/// create.
113124
RLIMIT_NPTS,
114125

115-
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))]
126+
#[cfg(any(target_os = "android",
127+
target_os = "freebsd",
128+
target_os = "netbsd",
129+
target_os = "openbsd",
130+
target_os = "linux",
131+
))]
116132
#[cfg_attr(docsrs, doc(cfg(all())))]
117133
/// When there is memory pressure and swap is available, prioritize
118134
/// eviction of a process' resident pages beyond this amount (in bytes).

0 commit comments

Comments
 (0)