Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 authored Aug 15, 2024
2 parents 66d53b6 + 1ffe0bd commit 7718581
Show file tree
Hide file tree
Showing 37 changed files with 654 additions and 183 deletions.
22 changes: 16 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
Thanks for considering submitting a PR!

We have the [contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). Please read it if you're new here!
We have the
[contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md).
Please read it if you're new here!

Here's a checklist for things that will be checked during review or continuous integration.
Here is a checklist for things that will be checked during review or continuous
integration:

- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s), e.g. edit `linux.txt` if you add an item to `src/unix/linux_like/linux/mod.rs`
- \[ ] Your PR doesn't contain any private or *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131))
- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove
item(s), e.g. edit `linux.txt` if you add an item to
`src/unix/linux_like/linux/mod.rs`
- \[ ] Your PR doesn't contain any private or _unstable_ values like `*LAST` or
`*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131))
- \[ ] Provide a link to relevant source (headers or documentation) if your PR
adds or changes API.
- \[ ] If your PR has a breaking change, please clarify it
- \[ ] If your PR increments version number, it must NOT contain any other changes (otherwise a release could be delayed)
- \[ ] If your PR increments version number, it must NOT contain any other
changes (otherwise a release could be delayed)
- \[ ] Make sure `ci/style.sh` passes
- \[ ] `cd libc-test && cargo test`
- (this might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure)
- (this might fail on your env due to environment difference between your env
and CI. Ignore local failures if you are not sure)

Delete this line and everything above before opening your PR.
41 changes: 35 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,41 @@
Welcome! If you are reading this document, it means you are interested in contributing
to the `libc` crate.

## v0.2 changes
## v1.0 Roadmap

If you want to add your changes to v0.2, please submit them to the `libc-0.2` branch.
If you want to add any breaking changes, it should be submitted to the main branch,
which has changes for v0.3.
We will support and make a new release for v0.2 until we make the first release of v0.3.
`libc` has two active branches: `main` and `libc-0.2`. `main` is for active
development of the upcoming v1.0 release, and should be the target of all pull
requests. `libc-0.2` is for updates to the currently released version.

If a pull request to `main` is a good candidate for inclusion in an `0.2.x`
release, include `@rustbot label stable-nominated` in a comment to propose this.
Good candidates will usually meet the following:

1. The included changes are non-breaking.
2. The change applies cleanly to both branches.
3. There is a usecase that justifies inclusion in a stable release (all
additions should always have a usecase, hopefully).

Once a `stable-nominated` PR targeting `main` has merged, it can be cherry
picked to the `libc-0.2` branch. A maintainer will likely do these cherry
picks in a batch.

Alternatively, you can start this process yourself by creating a new branch
based on `libc-0.2` and running `git cherry-pick -xe commit-sha-on-main` (`git
cherry-pick -xe start-sha^..end-sha` if a range of commits is needed). `git`
will automatically add the "cherry picked from commit" note, but try to add a
backport note so the original PR gets crosslinked:

```
# ... original commit message ...
(backport <https://github.com/rust-lang/libc/pull/1234>) # add manually
(cherry picked from commit 104b6a4ae31c726814c36318dc718470cc96e167) # added by git
```

Once the cherry-pick is complete, open a PR targeting `libc-0.2`.

See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details.

## Adding an API

Expand Down Expand Up @@ -51,7 +80,7 @@ With that in mind, the steps for adding a new API are:
5. Wait for a merge!

<sup>1</sup>: Note that this list has nothing to do with any Unix or Posix
standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`.
standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`.

## Test before you commit

Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ More detailed information about the design of this library can be found in its

[rfc]: https://github.com/rust-lang/rfcs/blob/HEAD/text/1291-promote-libc.md

## v0.3 Roadmap
## v1.0 Roadmap

The main branch is now for v0.3 which has some breaking changes.
Currently, `libc` has two active branches: `main` for the upcoming v1.0 release,
and `libc-0.2` for the currently published version. By default all pull requests
should target `main`; once reviewed, they can be cherry picked to the `libc-0.2`
branch if needed.

For v0.2, please submit PRs to the `libc-0.2` branch instead.
We will stop making new v0.2 releases once we release v0.3 on crates.io.
We will stop making new v0.2 releases once v1.0 is released.

See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details.
See the section in [CONTRIBUTING.md](CONTRIBUTING.md#v10-roadmap) for more
details.

## Usage

Expand Down
5 changes: 5 additions & 0 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ harness = true
name = "semver"
path = "test/semver.rs"
harness = false

[[test]]
name = "primitive_types"
path = "test/primitive_types.rs"
harness = true
23 changes: 21 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,7 @@ fn test_android(target: &str) {
"sched.h",
"semaphore.h",
"signal.h",
"spawn.h",
"stddef.h",
"stdint.h",
"stdio.h",
Expand All @@ -1562,6 +1563,7 @@ fn test_android(target: &str) {
"sys/fsuid.h",
"sys/inotify.h",
"sys/ioctl.h",
"sys/klog.h",
"sys/mman.h",
"sys/mount.h",
"sys/personality.h",
Expand Down Expand Up @@ -1635,6 +1637,8 @@ fn test_android(target: &str) {
"linux/netfilter/nfnetlink_log.h",
"linux/netfilter/nfnetlink_queue.h",
"linux/netfilter/nf_tables.h",
"linux/netfilter_arp.h",
"linux/netfilter_bridge.h",
"linux/netfilter_ipv4.h",
"linux/netfilter_ipv6.h",
"linux/netfilter_ipv6/ip6_tables.h",
Expand Down Expand Up @@ -1707,6 +1711,10 @@ fn test_android(target: &str) {

// FIXME: Somehow fails to test after removing cfg hacks:
"__uint128" => true,

// These are intended to be opaque
"posix_spawn_file_actions_t" => true,
"posix_spawnattr_t" => true,
_ => false,
}
});
Expand Down Expand Up @@ -2487,6 +2495,8 @@ fn test_freebsd(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// This is introduced in FreeBSD 14.1
"execvpe" => true,
// The `uname` function in the `utsname.h` FreeBSD header is a C
// inline function (has no symbol) that calls the `__xuname` symbol.
// Therefore the function pointer comparison does not make sense for it.
Expand Down Expand Up @@ -3342,6 +3352,7 @@ fn test_linux(target: &str) {
"sys/eventfd.h",
"sys/file.h",
"sys/fsuid.h",
"sys/klog.h",
"sys/inotify.h",
"sys/ioctl.h",
"sys/ipc.h",
Expand Down Expand Up @@ -3442,6 +3453,8 @@ fn test_linux(target: &str) {
"linux/netfilter/nfnetlink_log.h",
"linux/netfilter/nfnetlink_queue.h",
"linux/netfilter/nf_tables.h",
"linux/netfilter_arp.h",
"linux/netfilter_bridge.h",
"linux/netfilter_ipv4.h",
"linux/netfilter_ipv6.h",
"linux/netfilter_ipv6/ip6_tables.h",
Expand Down Expand Up @@ -3958,9 +3971,15 @@ fn test_linux(target: &str) {
| "MINSIGSTKSZ"
if gnu => true,

// FIXME: Linux >= 5.16 changed its value:
// FIXME: Linux >= 5.10:
// https://github.com/torvalds/linux/commit/d25e2e9388eda61b6e298585024ee3355f50c493
"NF_INET_INGRESS" if musl => true,

// FIXME: Linux >= 5.16:
// https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96
"NF_NETDEV_NUMHOOKS" => true,
"NF_NETDEV_EGRESS" if musl || sparc64 => true,
// value changed
"NF_NETDEV_NUMHOOKS" if musl || sparc64 => true,

// FIXME: requires Linux >= 5.6:
| "RESOLVE_BENEATH"
Expand Down
36 changes: 36 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,17 @@ KEXEC_ON_CRASH
KEXEC_PRESERVE_CONTEXT
KEY_CNT
KEY_MAX
KLOG_CLOSE
KLOG_OPEN
KLOG_READ
KLOG_READ_ALL
KLOG_READ_CLEAR
KLOG_CLEAR
KLOG_CONSOLE_OFF
KLOG_CONSOLE_ON
KLOG_CONSOLE_LEVEL
KLOG_SIZE_UNREAD
KLOG_SIZE_BUFFER
LC_ADDRESS
LC_ADDRESS_MASK
LC_ALL
Expand Down Expand Up @@ -1670,8 +1681,29 @@ NFULNL_COPY_PACKET
NFULNL_MSG_CONFIG
NFULNL_MSG_PACKET
NF_ACCEPT
NF_ARP
NF_ARP_FORWARD
NF_ARP_IN
NF_ARP_NUMHOOKS
NF_ARP_OUT
NF_BR_BROUTING
NF_BR_FORWARD
NF_BR_LOCAL_IN
NF_BR_LOCAL_OUT
NF_BR_NUMHOOKS
NF_BR_POST_ROUTING
NF_BR_PRE_ROUTING
NF_BR_PRI_BRNF
NF_BR_PRI_FILTER_BRIDGED
NF_BR_PRI_FILTER_OTHER
NF_BR_PRI_FIRST
NF_BR_PRI_LAST
NF_BR_PRI_NAT_DST_BRIDGED
NF_BR_PRI_NAT_DST_OTHER
NF_BR_PRI_NAT_SRC
NF_DROP
NF_INET_FORWARD
NF_INET_INGRESS
NF_INET_LOCAL_IN
NF_INET_LOCAL_OUT
NF_INET_NUMHOOKS
Expand All @@ -1693,6 +1725,7 @@ NF_IP6_PRI_MANGLE
NF_IP6_PRI_NAT_DST
NF_IP6_PRI_NAT_SRC
NF_IP6_PRI_RAW
NF_IP6_PRI_RAW_BEFORE_DEFRAG
NF_IP6_PRI_SECURITY
NF_IP6_PRI_SELINUX_FIRST
NF_IP6_PRI_SELINUX_LAST
Expand All @@ -1713,10 +1746,12 @@ NF_IP_PRI_MANGLE
NF_IP_PRI_NAT_DST
NF_IP_PRI_NAT_SRC
NF_IP_PRI_RAW
NF_IP_PRI_RAW_BEFORE_DEFRAG
NF_IP_PRI_SECURITY
NF_IP_PRI_SELINUX_FIRST
NF_IP_PRI_SELINUX_LAST
NF_MAX_VERDICT
NF_NETDEV_EGRESS
NF_NETDEV_INGRESS
NF_NETDEV_NUMHOOKS
NF_QUEUE
Expand Down Expand Up @@ -3363,6 +3398,7 @@ itimerval
key_t
kill
killpg
klogctl
lastlog
lchown
lconv
Expand Down
14 changes: 10 additions & 4 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ COPYFILE_STATE_SRC_FD
COPYFILE_STATE_SRC_FILENAME
COPYFILE_STATE_STATUS_CB
COPYFILE_STATE_STATUS_CTX
COPYFILE_STATE_XATTRNAME
COPYFILE_STATE_WAS_CLONED
COPYFILE_VERBOSE
COPYFILE_STATE_XATTRNAME
COPYFILE_UNLINK
COPYFILE_VERBOSE
COPYFILE_XATTR
CR0
CR1
Expand Down Expand Up @@ -441,6 +441,9 @@ F_LOG2PHYS
F_LOG2PHYS_EXT
F_NOCACHE
F_NODIRECT
F_OFD_GETLK
F_OFD_SETLK
F_OFD_SETLKW
F_PEOFPOSMODE
F_PREALLOCATE
F_PUNCHHOLE
Expand Down Expand Up @@ -1599,7 +1602,10 @@ _CS_PATH
_IOFBF
_IOLBF
_IONBF
_NSGetArgc
_NSGetArgv
_NSGetEnviron
_NSGetProgname
_POSIX_VDISABLE
_PTHREAD_COND_SIG_init
_PTHREAD_MUTEX_SIG_init
Expand Down Expand Up @@ -1976,19 +1982,19 @@ posix_spawn_file_actions_t
posix_spawnattr_destroy
posix_spawnattr_get_qos_class_np
posix_spawnattr_getarchpref_np
posix_spawnattr_getbinpref_np
posix_spawnattr_getflags
posix_spawnattr_getpgroup
posix_spawnattr_getsigdefault
posix_spawnattr_getsigmask
posix_spawnattr_init
posix_spawnattr_set_qos_class_np
posix_spawnattr_setarchpref_np
posix_spawnattr_setbinpref_np
posix_spawnattr_setflags
posix_spawnattr_setpgroup
posix_spawnattr_setsigdefault
posix_spawnattr_setsigmask
posix_spawnattr_getbinpref_np
posix_spawnattr_setbinpref_np
posix_spawnattr_t
posix_spawnp
preadv
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/freebsd-x86_64.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Elf64_Auxinfo
KINFO_FILE_SIZE
MAP_32BIT
_MC_FLAG_MASK
_MC_FPFMT_NODEV
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,7 @@ eui64_hostton
eui64_ntoa
eui64_ntohost
exect
execvpe
execvP
explicit_bzero
extattr_delete_fd
Expand Down Expand Up @@ -1981,6 +1982,7 @@ kcmp
kevent
key_t
killpg
kinfo_file
kinfo_getvmmap
kinfo_proc
kinfo_vmentry
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/fuchsia.txt
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ SOL_UDP
SOL_X25
SOMAXCONN
SO_BINDTODEVICE
SO_BINDTOIFINDEX
SO_BSDCOMPAT
SO_BUSY_POLL
SO_DOMAIN
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/illumos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pthread_attr_get_np
pthread_attr_getstackaddr
pthread_attr_setstack
Loading

0 comments on commit 7718581

Please sign in to comment.