Skip to content

Commit fb65331

Browse files
Merge #1761
1761: Add non-standard Linux `SysconfVar` variants r=asomers a=stevenengler Closes #1240. You can find these options near the end of https://man7.org/linux/man-pages/man3/sysconf.3.html. I can see that the libc crate defines these for Linux and Android, but I'm not sure if they're defined for any others as well. Co-authored-by: Steven Engler <[email protected]>
2 parents 5f859d1 + b7a2de0 commit fb65331

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
66
## [Unreleased] - ReleaseDate
77
### Added
88

9+
- Added four non-standard Linux `SysconfVar` variants
10+
(#[1761](https://github.com/nix-rust/nix/pull/1761))
911
- Added const constructors for `TimeSpec` and `TimeVal`
1012
(#[1760](https://github.com/nix-rust/nix/pull/1760))
1113
- Added `aio_writev` and `aio_readv`.

src/unistd.rs

+13
Original file line numberDiff line numberDiff line change
@@ -2668,6 +2668,19 @@ pub enum SysconfVar {
26682668
/// Integer value indicating version of the X/Open Portability Guide to
26692669
/// which the implementation conforms.
26702670
_XOPEN_VERSION = libc::_SC_XOPEN_VERSION,
2671+
/// The number of pages of physical memory. Note that it is possible for
2672+
/// the product of this value to overflow.
2673+
#[cfg(any(target_os="android", target_os="linux"))]
2674+
_PHYS_PAGES = libc::_SC_PHYS_PAGES,
2675+
/// The number of currently available pages of physical memory.
2676+
#[cfg(any(target_os="android", target_os="linux"))]
2677+
_AVPHYS_PAGES = libc::_SC_AVPHYS_PAGES,
2678+
/// The number of processors configured.
2679+
#[cfg(any(target_os="android", target_os="linux"))]
2680+
_NPROCESSORS_CONF = libc::_SC_NPROCESSORS_CONF,
2681+
/// The number of processors currently online (available).
2682+
#[cfg(any(target_os="android", target_os="linux"))]
2683+
_NPROCESSORS_ONLN = libc::_SC_NPROCESSORS_ONLN,
26712684
}
26722685

26732686
/// Get configurable system variables (see

0 commit comments

Comments
 (0)