Go to file
bors 1e8fdcb296 Auto merge of #1156 - rust-lang:dependabot/cargo/ctest-0.2.8, r=gnzlbg
Bump ctest from 0.2.7 to 0.2.8

Bumps [ctest](https://github.com/alexcrichton/ctest) from 0.2.7 to 0.2.8.
<details>
<summary>Commits</summary>

- See full diff in [compare view](https://github.com/alexcrichton/ctest/commits)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=ctest&package-manager=cargo&previous-version=0.2.7&new-version=0.2.8)](https://dependabot.com/compatibility-score.html?dependency-name=ctest&package-manager=cargo&previous-version=0.2.7&new-version=0.2.8)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>
2018-11-28 09:32:20 +00:00
ci Auto merge of #1130 - palfrey:strcase-various, r=alexcrichton 2018-11-27 01:51:49 +00:00
libc-test Bump ctest from 0.2.7 to 0.2.8 2018-11-28 07:00:26 +00:00
src Auto merge of #1155 - semarie:openbsd-unbreak, r=gnzlbg 2018-11-27 21:15:10 +00:00
.gitignore Add ~ to .gitignore 2016-01-29 21:34:19 +00:00
.travis.yml Upgrade Travis to using Xenial environment 2018-11-24 19:53:40 +00:00
appveyor.yml Use Reqwest backend for Appveyor, not Hyper which is deprecated 2018-11-20 23:30:56 +00:00
build.rs core::ffi::c_void is available since rustc 1.30 2018-11-21 16:43:24 +09:00
Cargo.lock Bump ctest from 0.2.7 to 0.2.8 2018-11-28 07:00:26 +00:00
Cargo.toml Use crates.io keywords and categories 2018-11-22 19:06:40 +01:00
LICENSE-APACHE
LICENSE-MIT
README.md Use crates.io keywords and categories 2018-11-22 19:06:40 +01:00

libc

Raw FFI bindings to platform libraries like libc.

Build Status Build status Latest version Documentation License

Usage

First, add the following to your Cargo.toml:

[dependencies]
libc = "0.2"

Next, add this to your crate root:

extern crate libc;

Currently libc by default links to the standard library, but if you would instead like to use libc in a #![no_std] situation or crate you can request this via:

[dependencies]
libc = { version = "0.2", default-features = false }

By default libc uses private fields in structs in order to enforce a certain memory alignment on them. These structs can be hard to instantiate outside of libc. To make libc use #[repr(align(x))], instead of the private fields, activate the align feature. This requires Rust 1.25 or newer:

[dependencies]
libc = { version = "0.2", features = ["align"] }

What is libc?

The primary purpose of this crate is to provide all of the definitions necessary to easily interoperate with C code (or "C-like" code) on each of the platforms that Rust supports. This includes type definitions (e.g. c_int), constants (e.g. EINVAL) as well as function headers (e.g. malloc).

This crate does not strive to have any form of compatibility across platforms, but rather it is simply a straight binding to the system libraries on the platform in question.

Public API

This crate exports all underlying platform types, functions, and constants under the crate root, so all items are accessible as libc::foo. The types and values of all the exported APIs match the platform that libc is compiled for.

More detailed information about the design of this library can be found in its associated RFC.

Adding an API

Want to use an API which currently isn't bound in libc? It's quite easy to add one!

The internal structure of this crate is designed to minimize the number of #[cfg] attributes in order to easily be able to add new items which apply to all platforms in the future. As a result, the crate is organized hierarchically based on platform. Each module has a number of #[cfg]'d children, but only one is ever actually compiled. Each module then reexports all the contents of its children.

This means that for each platform that libc supports, the path from a leaf module to the root will contain all bindings for the platform in question. Consequently, this indicates where an API should be added! Adding an API at a particular level in the hierarchy means that it is supported on all the child platforms of that level. For example, when adding a Unix API it should be added to src/unix/mod.rs, but when adding a Linux-only API it should be added to src/unix/notbsd/linux/mod.rs.

If you're not 100% sure at what level of the hierarchy an API should be added at, fear not! This crate has CI support which tests any binding against all platforms supported, so you'll see failures if an API is added at the wrong level or has different signatures across platforms.

With that in mind, the steps for adding a new API are:

  1. Determine where in the module hierarchy your API should be added.
  2. Add the API.
  3. Send a PR to this repo.
  4. Wait for CI to pass, fixing errors.
  5. Wait for a merge!

Test before you commit

We have two automated tests running on Travis:

  1. libc-test
  • cd libc-test && cargo test
  • Use the skip_*() functions in build.rs if you really need a workaround.
  1. Style checker
  • rustc ci/style.rs && ./style src

Releasing your change to crates.io

Now that you've done the amazing job of landing your new API or your new platform in this crate, the next step is to get that sweet, sweet usage from crates.io! The only next step is to bump the version of libc and then publish it. If you'd like to get a release out ASAP you can follow these steps:

  1. Update the version number in Cargo.toml, you'll just be bumping the patch version number.
  2. Run cargo update to regenerate the lockfile to encode your version bump in the lock file. You may pull in some other updated dependencies, that's ok.
  3. Send a PR to this repository. It should look like this, but it'd also be nice to fill out the description with a small rationale for the release (any rationale is ok though!)
  4. Once merged the release will be tagged and published by one of the libc crate maintainers.

Platforms and Documentation

The following platforms are currently tested and have documentation available:

Tested:

The following may be supported, but are not guaranteed to always work: