commit | c7f8beaae63991955305a579f43d776e56807fca | [log] [tgz] |
---|---|---|
author | Bob Badour <bbadour@google.com> | Tue Feb 16 22:08:40 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Feb 16 22:08:40 2021 +0000 |
tree | a270daa620dcb1380b5a5ff0ea7046b6d6e87578 | |
parent | 4845c67c113d69cf2fd630f778fb5ecf1471b65f [diff] | |
parent | 178a8982758d598a27ca51b08a181de902a38267 [diff] |
[LSC] Add LOCAL_LICENSE_KINDS to external/rust/crates/nix am: ff3f9c02ff am: 26df706623 am: 178a898275 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/nix/+/1588737 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I8d1b99b762ec584fbf333e9fdbe32f08d5e72edb
Nix seeks to provide friendly bindings to various *nix platform APIs (Linux, Darwin, ...). The goal is to not provide a 100% unified interface, but to unify what can be while still providing platform specific APIs.
For many system APIs, Nix provides a safe alternative to the unsafe APIs exposed by the libc crate. This is done by wrapping the libc functionality with types/abstractions that enforce legal/safe usage.
As an example of what Nix provides, examine the differences between what is exposed by libc and nix for the gethostname system call:
// libc api (unsafe, requires handling return code/errno) pub unsafe extern fn gethostname(name: *mut c_char, len: size_t) -> c_int; // nix api (returns a nix::Result<CStr>) pub fn gethostname<'a>(buffer: &'a mut [u8]) -> Result<&'a CStr>;
nix target support consists of two tiers. While nix attempts to support all platforms supported by libc, only some platforms are actively supported due to either technical or manpower limitations. Support for platforms is split into three tiers:
The following targets are supported by nix
:
Tier 1:
Tier 2:
Tier 3:
nix
requires Rust 1.36.0 or newer.
To use nix
, add this to your Cargo.toml
:
[dependencies] nix = "0.19.0"
Contributions are very welcome. Please See CONTRIBUTING for additional details.
Feel free to join us in the nix-rust/nix channel on Gitter to discuss nix
development.
Nix is licensed under the MIT license. See LICENSE for more details.