Skip to content

Commit 3066a5b

Browse files
authored
Merge pull request #1313 from nnethercote/add-libc
Add `libc-0.2.124`
2 parents 272e7d6 + 56a6f6e commit 3066a5b

File tree

220 files changed

+94171
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+94171
-0
lines changed

collector/benchmarks/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ They mostly consist of real-world crates.
3333
- **image-0.24.1**: Basic image processing functions and methods for
3434
converting to and from various image formats. Used often in graphics
3535
programming.
36+
- **libc-0.2.124**: An interface to `libc`. Contains many declarations of
37+
types, constants, and functions, but relatively little normal code. Stresses
38+
the parser. A very widely-used crate.
3639
- **regex-1.5.5**: A regular expression parser. Used by many Rust programs.
3740
- **ripgrep-13.0.0**: A line-oriented search tool. A widely-used utility.
3841
- **serde-1.0.136**: A serialization/deserialization crate. Used by many other
@@ -191,6 +194,8 @@ Rust code being written today.
191194
--id Test --profiles=Check --scenarios=IncrPatched
192195
--include=$NEW_BENCHMARK`
193196
- Add the new entry to `collector/benchmarks/README.md`.
197+
- `git add` the `Cargo.lock` file, if it's not already part of the
198+
benchmark's committed code.
194199
- Consider the benchmarking time for the benchmark.
195200
- First, measure the entire compilation time with something like this, by
196201
doing this within the benchmark directory is good:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "02f4f6cbccaf2c7cc22617a51f9717d5ac6c9a05"
4+
},
5+
"path_in_vcs": ""
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
Cargo.lock
3+
*~
4+
style
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/macros.rs b/src/macros.rs
2+
index 9fb7f7a7..39cbf962 100644
3+
--- a/src/macros.rs
4+
+++ b/src/macros.rs
5+
@@ -82,7 +82,7 @@ macro_rules! s {
6+
impl ::Copy for $i {}
7+
#[allow(deprecated)]
8+
impl ::Clone for $i {
9+
- fn clone(&self) -> $i { *self }
10+
+ fn clone(&self) -> $i { let x = *self; x }
11+
}
12+
);
13+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Contributing to `libc`
2+
3+
Welcome! If you are reading this document, it means you are interested in contributing
4+
to the `libc` crate.
5+
6+
## Adding an API
7+
8+
Want to use an API which currently isn't bound in `libc`? It's quite easy to add
9+
one!
10+
11+
The internal structure of this crate is designed to minimize the number of
12+
`#[cfg]` attributes in order to easily be able to add new items which apply
13+
to all platforms in the future. As a result, the crate is organized
14+
hierarchically based on platform. Each module has a number of `#[cfg]`'d
15+
children, but only one is ever actually compiled. Each module then reexports all
16+
the contents of its children.
17+
18+
This means that for each platform that libc supports, the path from a
19+
leaf module to the root will contain all bindings for the platform in question.
20+
Consequently, this indicates where an API should be added! Adding an API at a
21+
particular level in the hierarchy means that it is supported on all the child
22+
platforms of that level. For example, when adding a Unix API it should be added
23+
to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to
24+
`src/unix/linux_like/linux/mod.rs`.
25+
26+
If you're not 100% sure at what level of the hierarchy an API should be added
27+
at, fear not! This crate has CI support which tests any binding against all
28+
platforms supported, so you'll see failures if an API is added at the wrong
29+
level or has different signatures across platforms.
30+
31+
New symbol(s) (i.e. functions, constants etc.) should also be added to the
32+
symbols list(s) found in the `libc-test/semver` directory. These lists keep
33+
track of what symbols are public in the libc crate and ensures they remain
34+
available between changes to the crate. If the new symbol(s) are available on
35+
all supported Unixes it should be added to `unix.txt` list<sup>1</sup>,
36+
otherwise they should be added to the OS specific list(s).
37+
38+
With that in mind, the steps for adding a new API are:
39+
40+
1. Determine where in the module hierarchy your API should be added.
41+
2. Add the API, including adding new symbol(s) to the semver lists.
42+
3. Send a PR to this repo.
43+
4. Wait for CI to pass, fixing errors.
44+
5. Wait for a merge!
45+
46+
<sup>1</sup>: Note that this list has nothing to do with any Unix or Posix
47+
standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`.
48+
49+
## Test before you commit
50+
51+
We have two automated tests running on [GitHub Actions](https://github.com/rust-lang/libc/actions):
52+
53+
1. [`libc-test`](https://github.com/gnzlbg/ctest)
54+
- `cd libc-test && cargo test`
55+
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
56+
2. Style checker
57+
- `rustc ci/style.rs && ./style src`
58+
59+
## Breaking change policy
60+
61+
Sometimes an upstream adds a breaking change to their API e.g. removing outdated items,
62+
changing the type signature, etc. And we probably should follow that change to build the
63+
`libc` crate successfully. It's annoying to do the equivalent of semver-major versioning
64+
for each such change. Instead, we mark the item as deprecated and do the actual change
65+
after a certain period. The steps are:
66+
67+
1. Add `#[deprecated(since = "", note="")]` attribute to the item.
68+
- The `since` field should have a next version of `libc`
69+
(e.g., if the current version is `0.2.1`, it should be `0.2.2`).
70+
- The `note` field should have a reason to deprecate and a tracking issue to call for comments
71+
(e.g., "We consider removing this as the upstream removed it.
72+
If you're using it, please comment on #XXX").
73+
2. If we don't see any concerns for a while, do the change actually.
74+
75+
## Releasing your change to crates.io
76+
77+
Now that you've done the amazing job of landing your new API or your new
78+
platform in this crate, the next step is to get that sweet, sweet usage from
79+
crates.io! The only next step is to bump the version of libc and then publish
80+
it. If you'd like to get a release out ASAP you can follow these steps:
81+
82+
1. Increment the patch version number in `Cargo.toml` and `libc-test/Cargo.toml`.
83+
1. Send a PR to this repository. It should [look like this][example-pr], but it'd
84+
also be nice to fill out the description with a small rationale for the
85+
release (any rationale is ok though!)
86+
1. Once merged, the release will be tagged and published by one of the libc crate
87+
maintainers.
88+
89+
[example-pr]: https://github.com/rust-lang/libc/pull/2120

collector/benchmarks/libc-0.2.124/Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2+
#
3+
# When uploading crates to the registry Cargo will automatically
4+
# "normalize" Cargo.toml files for maximal compatibility
5+
# with all versions of Cargo and also rewrite `path` dependencies
6+
# to registry (e.g., crates.io) dependencies.
7+
#
8+
# If you are reading this file be aware that the original Cargo.toml
9+
# will likely look very different (and much more reasonable).
10+
# See Cargo.toml.orig for the original contents.
11+
12+
[package]
13+
name = "libc"
14+
version = "0.2.124"
15+
authors = ["The Rust Project Developers"]
16+
build = "build.rs"
17+
exclude = [
18+
"/ci/*",
19+
"/.github/*",
20+
"/.cirrus.yml",
21+
"/triagebot.toml",
22+
]
23+
description = """
24+
Raw FFI bindings to platform libraries like libc.
25+
"""
26+
homepage = "https://github.com/rust-lang/libc"
27+
documentation = "https://docs.rs/libc/"
28+
readme = "README.md"
29+
keywords = [
30+
"libc",
31+
"ffi",
32+
"bindings",
33+
"operating",
34+
"system",
35+
]
36+
categories = [
37+
"external-ffi-bindings",
38+
"no-std",
39+
"os",
40+
]
41+
license = "MIT OR Apache-2.0"
42+
repository = "https://github.com/rust-lang/libc"
43+
44+
[package.metadata.docs.rs]
45+
features = [
46+
"const-extern-fn",
47+
"extra_traits",
48+
]
49+
50+
[dependencies.rustc-std-workspace-core]
51+
version = "1.0.0"
52+
optional = true
53+
54+
[features]
55+
align = []
56+
const-extern-fn = []
57+
default = ["std"]
58+
extra_traits = []
59+
rustc-dep-of-std = [
60+
"align",
61+
"rustc-std-workspace-core",
62+
]
63+
std = []
64+
use_std = ["std"]
65+
66+
[workspace]

collector/benchmarks/libc-0.2.124/Cargo.toml.orig

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)