Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
patches/ | 03-May-2024 | - | 94 | 83 | ||
src/ | 03-May-2024 | - | 79,659 | 71,625 | ||
tests/ | 03-May-2024 | - | 6 | 3 | ||
.cargo_vcs_info.json | D | 03-May-2024 | 74 | 6 | 5 | |
.gitignore | D | 03-May-2024 | 27 | 5 | 4 | |
Android.bp | D | 03-May-2024 | 3.6 KiB | 145 | 135 | |
CONTRIBUTING.md | D | 03-May-2024 | 4.2 KiB | 90 | 69 | |
Cargo.toml | D | 03-May-2024 | 1.3 KiB | 39 | 36 | |
Cargo.toml.orig | D | 03-May-2024 | 878 | 33 | 29 | |
LICENSE | D | 03-May-2024 | 10.6 KiB | 202 | 169 | |
LICENSE-APACHE | D | 03-May-2024 | 10.6 KiB | 202 | 169 | |
LICENSE-MIT | D | 03-May-2024 | 1.1 KiB | 26 | 22 | |
METADATA | D | 03-May-2024 | 374 | 20 | 19 | |
MODULE_LICENSE_APACHE2 | D | 03-May-2024 | 0 | |||
OWNERS | D | 03-May-2024 | 40 | 2 | 1 | |
README.md | D | 03-May-2024 | 3.8 KiB | 107 | 74 | |
TEST_MAPPING | D | 03-May-2024 | 6.2 KiB | 304 | 303 | |
build.rs | D | 03-May-2024 | 5 KiB | 154 | 107 | |
cargo2android.json | D | 03-May-2024 | 254 | 13 | 13 | |
rustfmt.toml | D | 03-May-2024 | 30 | 2 | 1 |
README.md
1# libc - Raw FFI bindings to platforms' system libraries 2 3[![GHA Status]][GitHub Actions] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License] 4 5`libc` provides all of the definitions necessary to easily interoperate with C 6code (or "C-like" code) on each of the platforms that Rust supports. This 7includes type definitions (e.g. `c_int`), constants (e.g. `EINVAL`) as well as 8function headers (e.g. `malloc`). 9 10This crate exports all underlying platform types, functions, and constants under 11the crate root, so all items are accessible as `libc::foo`. The types and values 12of all the exported APIs match the platform that libc is compiled for. 13 14More detailed information about the design of this library can be found in its 15[associated RFC][rfc]. 16 17[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md 18 19## Usage 20 21Add the following to your `Cargo.toml`: 22 23```toml 24[dependencies] 25libc = "0.2" 26``` 27 28## Features 29 30* `std`: by default `libc` links to the standard library. Disable this 31 feature to remove this dependency and be able to use `libc` in `#![no_std]` 32 crates. 33 34* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`. 35 This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`. 36 37* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s. 38 This feature requires a nightly rustc. 39 40* **deprecated**: `use_std` is deprecated, and is equivalent to `std`. 41 42## Rust version support 43 44The minimum supported Rust toolchain version is **Rust 1.13.0** . APIs requiring 45newer Rust features are only available on newer Rust toolchains: 46 47| Feature | Version | 48|----------------------|---------| 49| `union` | 1.19.0 | 50| `const mem::size_of` | 1.24.0 | 51| `repr(align)` | 1.25.0 | 52| `extra_traits` | 1.25.0 | 53| `core::ffi::c_void` | 1.30.0 | 54| `repr(packed(N))` | 1.33.0 | 55| `cfg(target_vendor)` | 1.33.0 | 56 57## Platform support 58 59[Platform-specific documentation (master branch)][docs.master]. 60 61See 62[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/ci/build.sh) 63for the platforms on which `libc` is guaranteed to build for each Rust 64toolchain. The test-matrix at [GitHub Actions] and [Cirrus CI] show the 65platforms in which `libc` tests are run. 66 67<div class="platform_docs"></div> 68 69## License 70 71This project is licensed under either of 72 73* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) 74 ([LICENSE-APACHE](https://github.com/rust-lang/libc/blob/master/LICENSE-APACHE)) 75 76* [MIT License](https://opensource.org/licenses/MIT) 77 ([LICENSE-MIT](https://github.com/rust-lang/libc/blob/master/LICENSE-MIT)) 78 79at your option. 80 81## Contributing 82 83We welcome all people who want to contribute. Please see the [contributing 84instructions] for more information. 85 86[contributing instructions]: https://github.com/rust-lang/libc/blob/master/CONTRIBUTING.md 87 88Contributions in any form (issues, pull requests, etc.) to this project 89must adhere to Rust's [Code of Conduct]. 90 91[Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct 92 93Unless you explicitly state otherwise, any contribution intentionally submitted 94for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be 95dual licensed as above, without any additional terms or conditions. 96 97[GitHub Actions]: https://github.com/rust-lang/libc/actions 98[GHA Status]: https://github.com/rust-lang/libc/workflows/CI/badge.svg 99[Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc 100[Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg 101[crates.io]: https://crates.io/crates/libc 102[Latest Version]: https://img.shields.io/crates/v/libc.svg 103[Documentation]: https://docs.rs/libc/badge.svg 104[docs.rs]: https://docs.rs/libc 105[License]: https://img.shields.io/crates/l/libc.svg 106[docs.master]: https://rust-lang.github.io/libc/#platform-specific-documentation 107