Skip to content

Commit

Permalink
Merge #1761
Browse files Browse the repository at this point in the history
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 <opara@cs.georgetown.edu>
  • Loading branch information
bors[bot] and stevenengler committed Jul 13, 2022
2 parents 5f859d1 + b7a2de0 commit fb65331
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased] - ReleaseDate
### Added

- Added four non-standard Linux `SysconfVar` variants
(#[1761](https://github.com/nix-rust/nix/pull/1761))
- Added const constructors for `TimeSpec` and `TimeVal`
(#[1760](https://github.com/nix-rust/nix/pull/1760))
- Added `aio_writev` and `aio_readv`.
Expand Down
13 changes: 13 additions & 0 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2668,6 +2668,19 @@ pub enum SysconfVar {
/// Integer value indicating version of the X/Open Portability Guide to
/// which the implementation conforms.
_XOPEN_VERSION = libc::_SC_XOPEN_VERSION,
/// The number of pages of physical memory. Note that it is possible for
/// the product of this value to overflow.
#[cfg(any(target_os="android", target_os="linux"))]
_PHYS_PAGES = libc::_SC_PHYS_PAGES,
/// The number of currently available pages of physical memory.
#[cfg(any(target_os="android", target_os="linux"))]
_AVPHYS_PAGES = libc::_SC_AVPHYS_PAGES,
/// The number of processors configured.
#[cfg(any(target_os="android", target_os="linux"))]
_NPROCESSORS_CONF = libc::_SC_NPROCESSORS_CONF,
/// The number of processors currently online (available).
#[cfg(any(target_os="android", target_os="linux"))]
_NPROCESSORS_ONLN = libc::_SC_NPROCESSORS_ONLN,
}

/// Get configurable system variables (see
Expand Down

0 comments on commit fb65331

Please sign in to comment.