Skip to content

Commit

Permalink
Merge pull request #3521 from rust-lang/main
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jan 7, 2024
2 parents e673aaa + 72093f3 commit ee500ca
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 53 deletions.
58 changes: 16 additions & 42 deletions .github/workflows/full_ci.yml
Expand Up @@ -2,13 +2,16 @@ name: full CI

on:
merge_group:
push:
branches: ['main', 'libc-0.2']
pull_request:
branches:
- libc-0.2
types:
- labeled

jobs:
docker_linux_tier1:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Docker Linux Tier1
Expand All @@ -21,18 +24,15 @@ jobs:
x86_64-unknown-linux-gnu,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}

macos:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: macOS
Expand All @@ -44,18 +44,15 @@ jobs:
x86_64-apple-darwin,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
- name: Execute run.sh
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}

windows:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Windows
Expand All @@ -77,9 +74,6 @@ jobs:
ARCH: i686
- target: i686-pc-windows-msvc
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Self-update rustup
run: rustup self update
Expand All @@ -92,25 +86,22 @@ jobs:
shell: bash

style_check:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Style check
runs-on: ubuntu-22.04
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Check style
run: sh ci/style.sh

docker_linux_tier2:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Docker Linux Tier2
Expand Down Expand Up @@ -150,9 +141,6 @@ jobs:
# x86_64-unknown-redox,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
Expand All @@ -163,7 +151,6 @@ jobs:
# Because of this, only the nightly compiler can be used on these targets.
docker_linux_build_std:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

if: ${{ false }} # This is currently broken
Expand All @@ -178,9 +165,6 @@ jobs:
armv7-unknown-linux-uclibceabihf
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=nightly INSTALL_RUST_SRC=1 sh ./ci/install-rust.sh
Expand All @@ -189,26 +173,23 @@ jobs:

# devkitpro's pacman needs to be connected from Docker.
docker_switch:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Docker Switch
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh switch

build_channels_linux:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Build Channels Linux
Expand All @@ -233,16 +214,14 @@ jobs:
1.30.0,
]
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
- name: Execute build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh

build_channels_macos:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
contents: read # to fetch code (actions/checkout)

Expand All @@ -268,16 +247,14 @@ jobs:
- { toolchain: 1.30.0, os: macos-11 }
runs-on: ${{ matrix.target.os }}
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh
- name: Execute build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh

build_channels_windows:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
contents: read # to fetch code (actions/checkout)

Expand Down Expand Up @@ -305,16 +282,13 @@ jobs:
shell: bash

check_cfg:
if: github.event.label.name == 'libc-0.2-pre-merge-ci'
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: "Check #[cfg]s"
runs-on: ubuntu-22.04
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=nightly sh ./ci/install-rust.sh
Expand All @@ -325,7 +299,7 @@ jobs:
# protection, rather than having to add each job separately.
success:
name: Success
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: [
docker_linux_tier1,
docker_linux_tier2,
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -3,6 +3,13 @@
Welcome! If you are reading this document, it means you are interested in contributing
to the `libc` crate.

## v0.2 changes

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.

## Adding an API

Want to use an API which currently isn't bound in `libc`? It's quite easy to add
Expand Down
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -16,6 +16,15 @@ 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

The main branch is now for v0.3 which has some breaking changes.

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.

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

## Usage

Add the following to your `Cargo.toml`:
Expand Down
14 changes: 14 additions & 0 deletions libc-test/build.rs
Expand Up @@ -3705,6 +3705,12 @@ fn test_linux(target: &str) {
// https://github.com/torvalds/linux/commit/c05cd3645814724bdeb32a2b4d953b12bdea5f8c
"xdp_umem_reg_v1" => true,

// Is defined in `<linux/sched/types.h>` but if this file is included at the same time
// as `<sched.h>`, the `struct sched_param` is defined twice, causing the compilation to
// fail. The problem doesn't seem to be present in more recent versions of the linux
// kernel so we can drop this and test the type once this new version is used in CI.
"sched_attr" => true,

_ => false,
}
});
Expand Down Expand Up @@ -4123,6 +4129,14 @@ fn test_linux(target: &str) {
| "PF_MCE_EARLY"
| "PF_MEMALLOC_PIN" => true,

"SCHED_FLAG_KEEP_POLICY"
| "SCHED_FLAG_KEEP_PARAMS"
| "SCHED_FLAG_UTIL_CLAMP_MIN"
| "SCHED_FLAG_UTIL_CLAMP_MAX"
| "SCHED_FLAG_KEEP_ALL"
| "SCHED_FLAG_UTIL_CLAMP"
| "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers.

_ => false,
}
});
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/apple.txt
Expand Up @@ -2216,6 +2216,7 @@ shmid_ds
sigaltstack
sigevent
siginfo_t
sigsuspend
sigwait
sockaddr_ctl
sockaddr_dl
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/dragonfly.txt
Expand Up @@ -1538,6 +1538,7 @@ shmget
sigaltstack
sigevent
siginfo_t
sigsuspend
sigtimedwait
sigwait
sigwaitinfo
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/freebsd.txt
Expand Up @@ -2192,6 +2192,7 @@ shmid_ds
sigaltstack
sigevent
siginfo_t
sigsuspend
sigtimedwait
sigwait
sigwaitinfo
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/fuchsia.txt
Expand Up @@ -1377,8 +1377,10 @@ pthread_cancel
pthread_condattr_getclock
pthread_condattr_setclock
pthread_getattr_np
pthread_getname_np
pthread_kill
pthread_mutex_timedlock
pthread_setname_np
ptsname_r
pwritev
quotactl
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/netbsd.txt
Expand Up @@ -1538,6 +1538,7 @@ shmid_ds
sigaltstack
sigevent
siginfo_t
sigsuspend
sigtimedwait
sigwait
sigwaitinfo
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/openbsd.txt
Expand Up @@ -1260,6 +1260,7 @@ shmget
shmid_ds
sigaltstack
siginfo_t
sigsuspend
sigwait
sockaddr_dl
sockpeercred
Expand Down
2 changes: 2 additions & 0 deletions src/fuchsia/mod.rs
Expand Up @@ -3826,6 +3826,8 @@ extern "C" {
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;

pub fn getsockopt(
Expand Down
3 changes: 3 additions & 0 deletions src/psp.rs
Expand Up @@ -1382,15 +1382,18 @@ s_paren! {
pub struct SceUid(pub i32);

#[repr(transparent)]
#[allow(dead_code)]
pub struct SceMpeg(*mut *mut c_void);

#[repr(transparent)]
#[allow(dead_code)]
pub struct SceMpegStream(*mut c_void);

#[repr(transparent)]
pub struct Mp3Handle(pub i32);

#[repr(transparent)]
#[allow(dead_code)]
pub struct RegHandle(u32);
}

Expand Down
2 changes: 1 addition & 1 deletion src/teeos/mod.rs
Expand Up @@ -62,7 +62,7 @@ pub struct _CLongDouble(pub u128);

// long double in C means A float point value, which has 128bit length.
// but some bit maybe not used, so the really length of long double could be 80(x86) or 128(power pc/IEEE)
// this is different from f128(not stable and not inculded default) in Rust, so we use u128 for FFI(Rust to C).
// this is different from f128(not stable and not included default) in Rust, so we use u128 for FFI(Rust to C).
// this is unstable and will couse to memfault/data abort.
pub type c_longdouble = _CLongDouble;

Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/mod.rs
Expand Up @@ -761,6 +761,7 @@ extern "C" {
)]
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
pub fn getgrnam_r(
Expand Down
1 change: 1 addition & 0 deletions src/unix/haiku/mod.rs
Expand Up @@ -1782,6 +1782,7 @@ extern "C" {
groupcount: *mut ::c_int,
) -> ::c_int;
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
pub fn getgrnam_r(
Expand Down

0 comments on commit ee500ca

Please sign in to comment.