Skip to content

Commit ee500ca

Browse files
authored
Merge pull request #3521 from rust-lang/main
2 parents e673aaa + 72093f3 commit ee500ca

File tree

18 files changed

+146
-53
lines changed

18 files changed

+146
-53
lines changed

.github/workflows/full_ci.yml

+16-42
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ name: full CI
22

33
on:
44
merge_group:
5-
push:
6-
branches: ['main', 'libc-0.2']
5+
pull_request:
6+
branches:
7+
- libc-0.2
8+
types:
9+
- labeled
710

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

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

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

3838
name: macOS
@@ -44,18 +44,15 @@ jobs:
4444
x86_64-apple-darwin,
4545
]
4646
steps:
47-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
48-
with:
49-
github_token: "${{ secrets.GITHUB_TOKEN }}"
5047
- uses: actions/checkout@v4
5148
- name: Setup Rust toolchain
5249
run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
5350
- name: Execute run.sh
5451
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
5552

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

6158
name: Windows
@@ -77,9 +74,6 @@ jobs:
7774
ARCH: i686
7875
- target: i686-pc-windows-msvc
7976
steps:
80-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
81-
with:
82-
github_token: "${{ secrets.GITHUB_TOKEN }}"
8377
- uses: actions/checkout@v4
8478
- name: Self-update rustup
8579
run: rustup self update
@@ -92,25 +86,22 @@ jobs:
9286
shell: bash
9387

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

9993
name: Style check
10094
runs-on: ubuntu-22.04
10195
steps:
102-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
103-
with:
104-
github_token: "${{ secrets.GITHUB_TOKEN }}"
10596
- uses: actions/checkout@v4
10697
- name: Setup Rust toolchain
10798
run: sh ./ci/install-rust.sh
10899
- name: Check style
109100
run: sh ci/style.sh
110101

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

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

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

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

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

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

214195
name: Build Channels Linux
@@ -233,16 +214,14 @@ jobs:
233214
1.30.0,
234215
]
235216
steps:
236-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
237-
with:
238-
github_token: "${{ secrets.GITHUB_TOKEN }}"
239217
- uses: actions/checkout@v4
240218
- name: Setup Rust toolchain
241219
run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
242220
- name: Execute build.sh
243221
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
244222

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

@@ -268,16 +247,14 @@ jobs:
268247
- { toolchain: 1.30.0, os: macos-11 }
269248
runs-on: ${{ matrix.target.os }}
270249
steps:
271-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
272-
with:
273-
github_token: "${{ secrets.GITHUB_TOKEN }}"
274250
- uses: actions/checkout@v4
275251
- name: Setup Rust toolchain
276252
run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh
277253
- name: Execute build.sh
278254
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh
279255

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

@@ -305,16 +282,13 @@ jobs:
305282
shell: bash
306283

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

312289
name: "Check #[cfg]s"
313290
runs-on: ubuntu-22.04
314291
steps:
315-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD
316-
with:
317-
github_token: "${{ secrets.GITHUB_TOKEN }}"
318292
- uses: actions/checkout@v4
319293
- name: Setup Rust toolchain
320294
run: TOOLCHAIN=nightly sh ./ci/install-rust.sh
@@ -325,7 +299,7 @@ jobs:
325299
# protection, rather than having to add each job separately.
326300
success:
327301
name: Success
328-
runs-on: ubuntu-latest
302+
runs-on: ubuntu-22.04
329303
needs: [
330304
docker_linux_tier1,
331305
docker_linux_tier2,

CONTRIBUTING.md

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Welcome! If you are reading this document, it means you are interested in contributing
44
to the `libc` crate.
55

6+
## v0.2 changes
7+
8+
If you want to add your changes to v0.2, please submit them to the `libc-0.2` branch.
9+
If you want to add any breaking changes, it should be submitted to the main branch,
10+
which has changes for v0.3.
11+
We will support and make a new release for v0.2 until we make the first release of v0.3.
12+
613
## Adding an API
714

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

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ More detailed information about the design of this library can be found in its
1616

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

19+
## v0.3 Roadmap
20+
21+
The main branch is now for v0.3 which has some breaking changes.
22+
23+
For v0.2, please submit PRs to the `libc-0.2` branch instead.
24+
We will stop making new v0.2 releases once we release v0.3 on crates.io.
25+
26+
See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details.
27+
1928
## Usage
2029

2130
Add the following to your `Cargo.toml`:

libc-test/build.rs

+14
Original file line numberDiff line numberDiff line change
@@ -3705,6 +3705,12 @@ fn test_linux(target: &str) {
37053705
// https://github.com/torvalds/linux/commit/c05cd3645814724bdeb32a2b4d953b12bdea5f8c
37063706
"xdp_umem_reg_v1" => true,
37073707

3708+
// Is defined in `<linux/sched/types.h>` but if this file is included at the same time
3709+
// as `<sched.h>`, the `struct sched_param` is defined twice, causing the compilation to
3710+
// fail. The problem doesn't seem to be present in more recent versions of the linux
3711+
// kernel so we can drop this and test the type once this new version is used in CI.
3712+
"sched_attr" => true,
3713+
37083714
_ => false,
37093715
}
37103716
});
@@ -4123,6 +4129,14 @@ fn test_linux(target: &str) {
41234129
| "PF_MCE_EARLY"
41244130
| "PF_MEMALLOC_PIN" => true,
41254131

4132+
"SCHED_FLAG_KEEP_POLICY"
4133+
| "SCHED_FLAG_KEEP_PARAMS"
4134+
| "SCHED_FLAG_UTIL_CLAMP_MIN"
4135+
| "SCHED_FLAG_UTIL_CLAMP_MAX"
4136+
| "SCHED_FLAG_KEEP_ALL"
4137+
| "SCHED_FLAG_UTIL_CLAMP"
4138+
| "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers.
4139+
41264140
_ => false,
41274141
}
41284142
});

libc-test/semver/apple.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ shmid_ds
22162216
sigaltstack
22172217
sigevent
22182218
siginfo_t
2219+
sigsuspend
22192220
sigwait
22202221
sockaddr_ctl
22212222
sockaddr_dl

libc-test/semver/dragonfly.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,7 @@ shmget
15381538
sigaltstack
15391539
sigevent
15401540
siginfo_t
1541+
sigsuspend
15411542
sigtimedwait
15421543
sigwait
15431544
sigwaitinfo

libc-test/semver/freebsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,7 @@ shmid_ds
21922192
sigaltstack
21932193
sigevent
21942194
siginfo_t
2195+
sigsuspend
21952196
sigtimedwait
21962197
sigwait
21972198
sigwaitinfo

libc-test/semver/fuchsia.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1377,8 +1377,10 @@ pthread_cancel
13771377
pthread_condattr_getclock
13781378
pthread_condattr_setclock
13791379
pthread_getattr_np
1380+
pthread_getname_np
13801381
pthread_kill
13811382
pthread_mutex_timedlock
1383+
pthread_setname_np
13821384
ptsname_r
13831385
pwritev
13841386
quotactl

libc-test/semver/netbsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,7 @@ shmid_ds
15381538
sigaltstack
15391539
sigevent
15401540
siginfo_t
1541+
sigsuspend
15411542
sigtimedwait
15421543
sigwait
15431544
sigwaitinfo

libc-test/semver/openbsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,7 @@ shmget
12601260
shmid_ds
12611261
sigaltstack
12621262
siginfo_t
1263+
sigsuspend
12631264
sigwait
12641265
sockaddr_dl
12651266
sockpeercred

src/fuchsia/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3826,6 +3826,8 @@ extern "C" {
38263826
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
38273827
pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
38283828
pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
3829+
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
3830+
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
38293831
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
38303832

38313833
pub fn getsockopt(

src/psp.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1382,15 +1382,18 @@ s_paren! {
13821382
pub struct SceUid(pub i32);
13831383

13841384
#[repr(transparent)]
1385+
#[allow(dead_code)]
13851386
pub struct SceMpeg(*mut *mut c_void);
13861387

13871388
#[repr(transparent)]
1389+
#[allow(dead_code)]
13881390
pub struct SceMpegStream(*mut c_void);
13891391

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

13931395
#[repr(transparent)]
1396+
#[allow(dead_code)]
13941397
pub struct RegHandle(u32);
13951398
}
13961399

src/teeos/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub struct _CLongDouble(pub u128);
6262

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

src/unix/bsd/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ extern "C" {
761761
)]
762762
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
763763
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
764+
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
764765
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
765766
pub fn getdtablesize() -> ::c_int;
766767
pub fn getgrnam_r(

src/unix/haiku/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,7 @@ extern "C" {
17821782
groupcount: *mut ::c_int,
17831783
) -> ::c_int;
17841784
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
1785+
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
17851786
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
17861787
pub fn getdtablesize() -> ::c_int;
17871788
pub fn getgrnam_r(

0 commit comments

Comments
 (0)