| 790180ba | 16-Jun-2025 |
Collin Funk <[email protected]> |
Remove unessecary semicolons from definitions of `CMSG_NXTHDR`.
(backport <https://github.com/rust-lang/libc/pull/4492>) (cherry picked from commit a2cf7c82ed85530e6262b0bc4d6f14bcda91777f) |
| 1a418edf | 02-Jun-2025 |
Trevor Gross <[email protected]> |
lints: Remove `allow(dead_code)`
As discussed in [1], some changes to dead code warnings caused a lot of code to be inaccurately reported as dead in `libc`. The change was reverted and improved sinc
lints: Remove `allow(dead_code)`
As discussed in [1], some changes to dead code warnings caused a lot of code to be inaccurately reported as dead in `libc`. The change was reverted and improved since then, so we no longer need to skip this check.
Includes some changes to make things pass with the lint.
[1]: https://github.com/rust-lang/libc/issues/3740
(backport <https://github.com/rust-lang/libc/pull/4473>) (cherry picked from commit 77a21a816490ce7766dd653725c7e99743e4e315)
show more ...
|
| c04c92ed | 02-Jun-2025 |
Trevor Gross <[email protected]> |
Replace handwritten `Debug` impls with derives
`s_no_extra_traits!` doesn't derive `Debug` so there are a lot of handwritten implementations. However, since we have a derive-like solution for unions
Replace handwritten `Debug` impls with derives
`s_no_extra_traits!` doesn't derive `Debug` so there are a lot of handwritten implementations. However, since we have a derive-like solution for unions now (printing them like an opaque struct), there really isn't any reason these can't all be derived.
Add `derive(Debug)` to `s_no_extra_traits`, still gated behind `feature = "extra_traits"`, which allows getting rid of manual implementations.
(backport <https://github.com/rust-lang/libc/pull/4471>) (cherry picked from commit 65c39bf1b0c7b904cf512280860120307d17703b)
show more ...
|
| a598506f | 15-Apr-2025 |
Yuri Astrakhan <[email protected]> |
chore: apply some clippy lints
(backport <https://github.com/rust-lang/libc/pull/4415>) [ drop changes around the FreeBSD version in build.rs since the logic isn't the same - Trevor ] (cherry pick
chore: apply some clippy lints
(backport <https://github.com/rust-lang/libc/pull/4415>) [ drop changes around the FreeBSD version in build.rs since the logic isn't the same - Trevor ] (cherry picked from commit a283b9e66d4a8e9371b0aa69d8534010a1c7d9e7)
show more ...
|
| e56ab23a | 26-May-2025 |
Petr Sumbera <[email protected]> |
Fixes Solaris CI after solaris-vm was updated to Solaris 11.4.81 CBE
It also specifies exact solaris-vm version to avoid future disruptions.
(backport <https://github.com/rust-lang/libc/pull/4462>)
Fixes Solaris CI after solaris-vm was updated to Solaris 11.4.81 CBE
It also specifies exact solaris-vm version to avoid future disruptions.
(backport <https://github.com/rust-lang/libc/pull/4462>) (cherry picked from commit d450f9c27a4f0a28087f7d0cba9d680bf8b0b233)
show more ...
|
| 66b58759 | 14-Apr-2025 |
Yuri Astrakhan <[email protected]> |
chore: minor cleanup `mode_t` usage
`crate::mode_t` is almost never needed because it is part of prelude. Moreover, in many cases `mode_t` was already used without the prefix - thus confusing if th
chore: minor cleanup `mode_t` usage
`crate::mode_t` is almost never needed because it is part of prelude. Moreover, in many cases `mode_t` was already used without the prefix - thus confusing if they are different or not. Keeping it the same helps readability.
(backport <https://github.com/rust-lang/libc/pull/4405>) [ Resolve conflict around vxworks S_* constants - Trevor ] (cherry picked from commit 1984cc22406f45cae7d6c6e2a1d1bc3faa6dc3e8)
show more ...
|
| 1ff2f218 | 09-Apr-2025 |
David Carlier <[email protected]> |
adding linux glibc ptrace_sud_config and related PTRACE_*ET_SYSCALL_USER_DISPATCH_CONFIG.
[ref](https://github.com/torvalds/linux/blob/a24588245776dafc227243a01bfbeb8a59bafba9/include/uapi/linux/ptr
adding linux glibc ptrace_sud_config and related PTRACE_*ET_SYSCALL_USER_DISPATCH_CONFIG.
[ref](https://github.com/torvalds/linux/blob/a24588245776dafc227243a01bfbeb8a59bafba9/include/uapi/linux/ptrace.h#L138) [ref](https://github.com/torvalds/linux/blob/a24588245776dafc227243a01bfbeb8a59bafba9/include/uapi/linux/ptrace.h#L115)
(backport <https://github.com/rust-lang/libc/pull/4386>) (cherry picked from commit 795a6d6e6619742755e79db38bb33da7d534d9a7)
show more ...
|
| 8e5fa76c | 13-Mar-2025 |
yuvraj wale <[email protected]> |
solarish: restrict openpty and forkpty polyfills to illumos, replace Solaris implementation with FFI
(backport <https://github.com/rust-lang/libc/pull/4329>) (cherry picked from commit e9d29ecaf9b9f
solarish: restrict openpty and forkpty polyfills to illumos, replace Solaris implementation with FFI
(backport <https://github.com/rust-lang/libc/pull/4329>) (cherry picked from commit e9d29ecaf9b9f14bb7a2c8dcd2f9856e63abef21)
show more ...
|
| cb50c4a7 | 16-Mar-2025 |
Dan Gohman <[email protected]> |
Add timerfd APIs for illumos and NetBSD.
illumos and NetBSD >= 10 support Linux-compatble timerfd APIs.
This is based on the headers for [illumos] and [NetBSD].
[illumos]: https://code.illumos.org
Add timerfd APIs for illumos and NetBSD.
illumos and NetBSD >= 10 support Linux-compatble timerfd APIs.
This is based on the headers for [illumos] and [NetBSD].
[illumos]: https://code.illumos.org/plugins/gitiles/illumos-gate/+/refs/heads/master/usr/src/uts/common/sys/timerfd.h#34 [NetBSD]: https://nxr.netbsd.org/xref/src/sys/sys/timerfd.h#44
(backport <https://github.com/rust-lang/libc/pull/4333>) (cherry picked from commit b2b17022cbd4190cbf342961f1162daee4bb037f)
show more ...
|
| 05df979b | 21-Mar-2025 |
Petr Sumbera <[email protected]> |
temporarily define O_DIRECT and SIGINFO for Solaris
(backport <https://github.com/rust-lang/libc/pull/4348>) (cherry picked from commit 141c6d7d6929a6a2dfc12bcfec0a1d751838b10a) |
| 2480f372 | 19-Mar-2025 |
David Carlier <[email protected]> |
adding secure_getenv for solaris/illumos.
[solaris](https://docs.oracle.com/cd/E88353_01/html/E37843/secure-getenv-3c.html) [illumos](https://github.com/illumos/illumos-gate/blob/dc7ec32189c86a0f330
adding secure_getenv for solaris/illumos.
[solaris](https://docs.oracle.com/cd/E88353_01/html/E37843/secure-getenv-3c.html) [illumos](https://github.com/illumos/illumos-gate/blob/dc7ec32189c86a0f330aee77229dad2ad57eac71/usr/src/man/man3c/getenv.3c#L12)
(backport <https://github.com/rust-lang/libc/pull/4342>) (cherry picked from commit 351a99dc31c2f27b70e25c2d93377eba5d2f452e)
show more ...
|
| 867fc9fb | 26-Feb-2025 |
Eliza Weisman <[email protected]> |
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
These socket options are currently defined only on macOS and friends, but they exist on illumos and Solaris as well.
This commit defines these soc
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
These socket options are currently defined only on macOS and friends, but they exist on illumos and Solaris as well.
This commit defines these socket options on solarish operating systems.
On Solaris, see the man page [`ip(7P)`].
I'd like to provide a link to the illumos manual pages, but apparently https://illumos.org/man seems to be impacted by today's AWS outage.
The constants are defined in `/usr/include/netinet/in.h`:
```console eliza@atrium ~ $ uname -a SunOS atrium 5.11 helios-2.0.22827 i86pc i386 i86pc eliza@atrium ~ $ rg 'IP(V6)?_BOUND_IF' /usr/include /usr/include/netinet/in.h 978:#define IP_BOUND_IF 0x41 /* bind socket to an ifindex */ 1311:#define IPV6_BOUND_IF 0x41 /* bind to an ifindex */ ```
[`ip(7P)`]: https://docs.oracle.com/cd/E86824_01/html/E54777/ip-7p.html
- [x] Relevant tests in `libc-test/semver` have been updated - [x] No placeholder or unstable values like `*LAST` or `*MAX` are included (see [#3131](https://github.com/rust-lang/libc/issues/3131)) - [x] Tested locally (`cd libc-test && cargo test --target mytarget`); especially relevant for platforms that may not be checked in CI
(backport <https://github.com/rust-lang/libc/pull/4287>) (cherry picked from commit 885148d575cac3dd8473369271657fd425c3e300)
show more ...
|
| 903dc232 | 24-Feb-2025 |
lvllvl <[email protected]> |
chore: add labels to each FIXME
(backport <https://github.com/rust-lang/libc/pull/4231>) (cherry picked from commit 861246a7e1ae9d9ad6b8d356ebb47ab5ad1b43df) |
| e2f92909 | 04-Feb-2025 |
Aphek <[email protected]> |
Copy definitions from core::ffi and centralize them
(backport <https://github.com/rust-lang/libc/pull/4256>) (cherry picked from commit 95446f458e472511d65e560224c1b85570e50944)
[ include the neces
Copy definitions from core::ffi and centralize them
(backport <https://github.com/rust-lang/libc/pull/4256>) (cherry picked from commit 95446f458e472511d65e560224c1b85570e50944)
[ include the necessary changes for psp, which isn't part of the original commit since the target is not present on main - Trevor ]
show more ...
|
| e943c982 | 11-Feb-2025 |
Rain <[email protected]> |
[solarish/illumos] add the posix_spawn family of functions
Add definitions from `spawn.h` as present [in illumos-gate (blame view)][spawn-h]. I added definitions more than 15 years old to `solarish/
[solarish/illumos] add the posix_spawn family of functions
Add definitions from `spawn.h` as present [in illumos-gate (blame view)][spawn-h]. I added definitions more than 15 years old to `solarish/mod.rs`, and others to `solarish/illumos.rs`.
There are a lot of definitions here -- it's easiest to look at them in the blame view linked above. But here are the corresponding man pages:
For solarish:
* [`posix_spawn`, `posix_spawnp`](https://illumos.org/man/3C/posix_spawn) * [`posix_spawn_file_actions_{init,destroy}`](https://illumos.org/man/3C/posix_spawn_file_actions_init) * [`posix_spawn_file_actions_{addopen,addclose}`](https://illumos.org/man/3C/posix_spawn_file_actions_addopen) * [`posix_spawn_file_actions_adddup2`](https://illumos.org/man/3C/posix_spawn_file_actions_adddup2) * [`posix_spawn_file_actions_addclosefrom_np`](https://illumos.org/man/3C/posix_spawn_file_actions_addclosefrom_np) * [`posix_spawnattr_{init,destroy}`](https://illumos.org/man/3C/posix_spawnattr_init) * [`posix_spawnattr_{setflags,getflags}`](https://illumos.org/man/3C/posix_spawnattr_setflags) * [`posix_spawnattr_{setpgroup,getpgroup}`](https://illumos.org/man/3C/posix_spawnattr_setpgroup) * [`posix_spawnattr_{setschedparam,getschedparam}`](https://illumos.org/man/3C/posix_spawnattr_setschedparam) * [`posix_spawnattr_{setschedpolicy,getschedpolicy}`](https://illumos.org/man/3C/posix_spawnattr_setschedpolicy) * [`posix_spawnattr_{setsigdefault,getsigdefault}`](https://illumos.org/man/3C/posix_spawnattr_setsigdefault) * [`posix_spawnattr_{setsigignore,getsigignore}_np`](https://illumos.org/man/3C/posix_spawnattr_setsigignore_np) * [`posix_spawnattr_{setsigmask,getsigmask}`](https://illumos.org/man/3C/posix_spawnattr_setsigmask)
Newer functions added independently to Solaris and illumos:
* [`posix_spawn_file_actions_{addchdir,addchdir_np,addfchdir}` on Solaris](https://docs.oracle.com/cd/E88353_01/html/E37843/posix-spawn-file-actions-addchdir-np-3c.html)
* The illumos-only functions are quite recent so the man pages haven't been uploaded to illumos.org yet. But [here's the one for `addchdir` and `addfchdir`](https://github.com/illumos/illumos-gate/blob/7633a05bff8c639f2df722d1fba7b889b2763d3d/usr/src/man/man3c/posix_spawn_file_actions_addchdir.3c). Note that the `_np` functions are not documented in the manual, but they are available for compatibility.
The one function I skipped over was [`posix_spawn_pipe_np`](https://illumos.org/man/3C/posix_spawn_pipe_np) -- it seemed a bit niche and I wasn't quite sure how to model `boolean_t`.
[spawn-h]: https://github.com/illumos/illumos-gate/blame/7633a05bff8c639f2df722d1fba7b889b2763d3d/usr/src/head/spawn.h#L1
(backport <https://github.com/rust-lang/libc/pull/4259>) (cherry picked from commit 162e3064659bbcfa857e606f47cbe90874cb6001)
show more ...
|
| 8448147a | 18-Dec-2024 |
Taiki Endo <[email protected]> |
Define c_char at top-level and remove per-target c_char definitions
(backport <https://github.com/rust-lang/libc/pull/4202>) (cherry picked from commit 0a02b941cf105dc4d4c5b5bd1ddc7bb546ad89c9) |
| 2ade12cd | 17-Dec-2024 |
Trevor Gross <[email protected]> |
Replace arch-conditional `c_char` with a reexport
For any platforms that have `c_char` within a `cfg_if` block, ensure they match the top-level `arch` definitions and reexport that to clean up code.
Replace arch-conditional `c_char` with a reexport
For any platforms that have `c_char` within a `cfg_if` block, ensure they match the top-level `arch` definitions and reexport that to clean up code.
(backport <https://github.com/rust-lang/libc/pull/4205>) (cherry picked from commit fead383bf485cbed830b2686cf45ae5a12b74138)
show more ...
|
| 7e761a52 | 17-Dec-2024 |
Taiki Endo <[email protected]> |
Fix c_char on various targets
- aarch64-kmc-solid_asp3 - armv7a-kmc-solid_asp3-eabi - armv7a-kmc-solid_asp3-eabihf - riscv64-linux-android - x86_64-unknown-l4re-uclibc - armv7-sony-vita-newlibeabihf
Fix c_char on various targets
- aarch64-kmc-solid_asp3 - armv7a-kmc-solid_asp3-eabi - armv7a-kmc-solid_asp3-eabihf - riscv64-linux-android - x86_64-unknown-l4re-uclibc - armv7-sony-vita-newlibeabihf - riscv32imac-unknown-nuttx-elf - riscv32imafc-unknown-nuttx-elf - riscv32imc-unknown-nuttx-elf - riscv64gc-unknown-nuttx-elf - riscv64imac-unknown-nuttx-elf - thumbv6m-nuttx-eabi - thumbv7em-nuttx-eabi - thumbv7em-nuttx-eabihf - thumbv7m-nuttx-eabi - thumbv8m.base-nuttx-eabi - thumbv8m.main-nuttx-eabi - thumbv8m.main-nuttx-eabihf - aarch64-unknown-redox - aarch64-unknown-illumos - riscv32-wrs-vxworks - riscv64-wrs-vxworks
(backport <https://github.com/rust-lang/libc/pull/4199>) (cherry picked from commit 0344a78d8ebfc3bf9c924df994541df6ac72280d)
show more ...
|
| 7457aa18 | 07-Dec-2024 |
Juan Aguilar Santillana <[email protected]> |
fix: make Debug impl for unions opaque
(backport <https://github.com/rust-lang/libc/pull/4176>) (cherry picked from commit 6faa521f32fc11db9fc43a248a64463ce288b48d)
[ resolve conflicts and update b
fix: make Debug impl for unions opaque
(backport <https://github.com/rust-lang/libc/pull/4176>) (cherry picked from commit 6faa521f32fc11db9fc43a248a64463ce288b48d)
[ resolve conflicts and update based on some main vs. 0.2 differences - Trevor ]
show more ...
|
| 76b35d38 | 03-Dec-2024 |
Rain <[email protected]> |
[solaris/illumos] add SIGRTMIN and SIGRTMAX
Add these functions, similar to the Linux ones. Also add tests.
For illumos, the source code is at [1] and documentation is at [2]. Blame suggests that S
[solaris/illumos] add SIGRTMIN and SIGRTMAX
Add these functions, similar to the Linux ones. Also add tests.
For illumos, the source code is at [1] and documentation is at [2]. Blame suggests that Solaris also supports the same calls.
[1]: https://github.com/illumos/illumos-gate/blame/27ecbff00d8c86a2647d6fe325cacb220d712115/usr/src/uts/common/sys/iso/signal_iso.h#L100-L101 [2]: https://illumos.org/man/3HEAD/signal.h
(backport <https://github.com/rust-lang/libc/pull/4171>) (cherry picked from commit a8aaadfd77362fefa534c76d29a17f3cad5bddfa)
show more ...
|
| 108310db | 27-Nov-2024 |
Trevor Gross <[email protected]> |
Make use of the crate's prelude to replace individual imports
Automatically apply changes with the following:
#!/bin/bash
set -eux
files=()
# Types either defined in this crate o
Make use of the crate's prelude to replace individual imports
Automatically apply changes with the following:
#!/bin/bash
set -eux
files=()
# Types either defined in this crate or in `core` prelude_types=( c_char c_double c_float c_int c_longlong c_long c_short c_uchar c_uint c_ulonglong c_ulong c_ushort c_void intptr_t size_t ssize_t Clone Copy Option Send Sync )
# Reexports from core prelude_modules=( fmt hash iter mem )
# Everything in the prelude prelude=( "${prelude_types[@]}" "${prelude_modules[@]}" )
# Generate a list of all files excluding `lib.rs` (since the prelude being # defined there makes string matching weird). while IFS= read -r -d '' file; do files+=("$file") done < <(find src -name '*.rs' -not -name '*lib.rs' -not -name '*macros.rs' -not -name 'fixed_width_ints.rs' -print0)
for file in "${files[@]}"; do needs_prelude=0
# If the file already has some sort of glob import, skip it if rg --pcre2 -q 'use (crate|super)::(?!prelude).*\*' "$file"; then continue fi
# Core types always require the prelude to handle rustc-dep-of-std if rg --pcre2 -q '\b(?<!\.)(Option|Clone|Copy|Send|Sync|fmt|hash|iter|mem)\b' "$file"; then needs_prelude=1 fi
# If we use any types that are specified in the prelude then we will import it for ty in "${prelude[@]}"; do # If the type is defined in the current module, we don't need it from the prelude if rg -q "type $ty =" "$file"; then continue fi
if rg -qU '((crate|super)::'"$ty"'|use (crate|super)::(\{\n){0,2}.*'"$ty)" "$file"; then needs_prelude=1 fi done
# Check if the prelude is needed and does not already exist; if so, add it if [ "$needs_prelude" = "1" ] && ! rg -q 'use crate::prelude::\*' "$file"; then # Split the file into two parts: module-level attributes and rest # Imports will be added after module-level attributes
attrs=$(awk '/^#!|^\/\/!/ {found=NR} {lines[NR]=$0} END {for (i=1; i<=found; i++) print lines[i]}' "$file") rest=$(awk '/^#!|^\/\/!/ {found=NR} END {if (found) {for (i=found+1; i<=NR; i++) print lines[i]} else {for (i=1; i<=NR; i++) print lines[i]}} {lines[NR]=$0}' "$file")
printf "%s\n" "$attrs" > "$file" printf "\n%s\n\n" "use crate::prelude::*;" >> "$file" printf "%s" "$rest" >> "$file" fi
for ty in "${prelude[@]}"; do export TY="$ty" # env for perl to use
# Remove simple imports `use crate::ty;` perl -pi -0777 -e 's/use ((crate|super)::)?($ENV{TY});//g' "$file"
# Remove the type if it is part of a group import perl -pi -0777 -e 's/(use (crate|super)::\{?(.*|(\n.*){0,2}))\b$ENV{TY}\b,? ?/$1/g' "$file"
# Replace pathed `crate::ty` perl -pi -0777 -e 's/(crate|super)::($ENV{TY})\b/$2/g' "$file" done
# For some reason, rustfmt doesn't trim leading newlines. Do so manually here. perl -pi -0777 -e 's/\A\n+//' "$file"
rustfmt "$file" done
./ci/style.sh
(backport <https://github.com/rust-lang/libc/pull/4161>) (cherry picked from commit f8a018a8e3efaf8cc4fbad84974255b0fa899fc2)
Applied by rerunning the script rather than resolving conflicts manually.
show more ...
|
| 0c7b0048 | 25-Nov-2024 |
David Carlier <[email protected]> |
solarish update stat type with st_fstype field.
(backport <https://github.com/rust-lang/libc/pull/4145>) (cherry picked from commit bd5a0d30a090ed6d387dadc9e922e62d581dd79e) |
| 86745492 | 27-Nov-2024 |
Eduardo Sánchez Muñoz <[email protected]> |
Handle remaining leading `::` in paths
I looked for `[^\w]::` and fixed them manually.
(backport <https://github.com/rust-lang/libc/pull/4162>) (cherry picked from commit 82d30c6a287fcbb186539cd21b
Handle remaining leading `::` in paths
I looked for `[^\w]::` and fixed them manually.
(backport <https://github.com/rust-lang/libc/pull/4162>) (cherry picked from commit 82d30c6a287fcbb186539cd21b663e2ee1f48a75)
show more ...
|
| 643182f7 | 26-Nov-2024 |
Eduardo Sánchez Muñoz <[email protected]> |
Automatic migration to Rust edition 2021
Migration script:
```sh set -ex
git restore Cargo.toml src
for file in $(find src -name "*.rs"); do perl -pi -077 -e 's/(?<!\w)::(Option|Copy|Clone)\b/$
Automatic migration to Rust edition 2021
Migration script:
```sh set -ex
git restore Cargo.toml src
for file in $(find src -name "*.rs"); do perl -pi -077 -e 's/(?<!\w)::(Option|Copy|Clone)\b/$1/g' "$file" done
implicit_c_long_ulong_char=( src/fuchsia/mod.rs src/solid/mod.rs src/unix/aix/mod.rs src/unix/bsd/apple/mod.rs src/unix/bsd/freebsdlike/freebsd/mod.rs src/unix/bsd/freebsdlike/mod.rs src/unix/bsd/netbsdlike/netbsd/mod.rs src/unix/bsd/netbsdlike/openbsd/mod.rs src/unix/bsd/netbsdlike/mod.rs src/unix/bsd/mod.rs src/unix/haiku/mod.rs src/unix/hurd/mod.rs src/unix/linux_like/android/b32/mod.rs src/unix/linux_like/android/b64/mod.rs src/unix/linux_like/android/mod.rs src/unix/linux_like/linux/gnu/b32/mod.rs src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs src/unix/linux_like/linux/gnu/b64/mod.rs src/unix/linux_like/linux/gnu/mod.rs src/unix/linux_like/linux/musl/mod.rs src/unix/linux_like/linux/uclibc/mips/mod.rs src/unix/linux_like/linux/uclibc/mod.rs src/unix/linux_like/linux/mod.rs src/unix/linux_like/mod.rs src/unix/newlib/mod.rs src/unix/nto/mod.rs src/unix/mod.rs src/vxworks/mod.rs )
for file in "${implicit_c_long_ulong_char[@]}"; do perl -pi -077 -e 's/(?<!\w)::(c_long|c_ulong|c_char)\b/$1/g' "$file" done
implicit_off_t=( src/unix/linux_like/linux/gnu/mod.rs src/unix/linux_like/linux/mod.rs src/unix/linux_like/mod.rs src/unix/mod.rs )
for file in "${implicit_off_t[@]}"; do perl -pi -077 -e 's/(?<!\w)::(off_t)\b/$1/g' "$file" done
implicit_off64_t=( src/unix/linux_like/android/mod.rs src/unix/linux_like/mod.rs )
for file in "${implicit_off64_t[@]}"; do perl -pi -077 -e 's/(?<!\w)::(off64_t)\b/$1/g' "$file" done
implicit_Ioctl=( src/unix/linux_like/linux/mod.rs )
for file in "${implicit_Ioctl[@]}"; do perl -pi -077 -e 's/(?<!\w)::(Ioctl)\b/$1/g' "$file" done
perl -pi -077 -e 's/(?<!\w)::(__u8|__u16|__u32|__s16|__s32)\b/$1/g' src/unix/linux_like/linux/mod.rs
perl -pi -077 -e 's/(?<!\w)::(SIG[A-Z]+)\b/$1/g' src/unix/solarish/mod.rs
perl -pi -077 -e 's/(?<!\w)::c_ulong\b/crate::c_ulong/g' src/unix/newlib/generic.rs perl -pi -077 -e 's/(?<!\w)::c_ulong\b/crate::c_ulong/g' src/unix/linux_like/linux/arch/generic/mod.rs perl -pi -077 -e 's/(?<!\w)::c_ulonglong\b/crate::c_ulonglong/g' src/unix/linux_like/linux/gnu/b64/mod.rs perl -pi -077 -e 's/(?<!\w)::c_ulonglong\b/crate::c_ulonglong/g' src/unix/linux_like/linux/mod.rs perl -pi -077 -e 's/(?<!\w)::c_ulonglong\b/crate::c_ulonglong/g' src/unix/linux_like/mod.rs perl -pi -077 -e 's/(?<!\w)::c_short\b/crate::c_short/g' src/unix/linux_like/linux/gnu/b32/mod.rs perl -pi -077 -e 's/(?<!\w)::c_short\b/crate::c_short/g' src/unix/newlib/mod.rs perl -pi -077 -e 's/(?<!\w)::c_float\b/c_float/g' src/unix/linux_like/linux/gnu/b64/s390x.rs perl -pi -077 -e 's/(?<!\w)::c_float\b/c_float/g' src/unix/linux_like/linux/musl/b64/s390x.rs
function handle_type() { type="$1" uses_type="$(rg -l "[^\w]::$type\b" src || echo)" has_type_def="$(rg -l "(type|struct) $type " src || echo)" has_type_import="$(rg -l "use ([0-9a-zA-Z_]+::)*$type;" src || echo)"
add_import=($(comm -3 <(echo "$uses_type" | sort) <(printf "%s\n%s" "$has_type_def" "$has_type_import" | sort) | cut -f1)) for file in "${add_import[@]}"; do # Split the file into two parts: module-level attributes and rest # Imports will be added after module-level attributes
awk '/^#!|^\/\/!/ {found=NR} {lines[NR]=$0} END {for (i=1; i<=found; i++) print lines[i]}' \ "$file" > "$file.attrs" awk '/^#!|^\/\/!/ {found=NR} END {if (found) {for (i=found+1; i<=NR; i++) print lines[i]} else {for (i=1; i<=NR; i++) print lines[i]}} {lines[NR]=$0}' \ "$file" > "$file.rest"
cat "$file.attrs" > "$file" echo >> "$file" echo 'use crate::'"$type"';' >> "$file" echo >> "$file" cat "$file.rest" >> "$file"
rm "$file.attrs" "$file.rest" done
for file in $uses_type; do perl -pi -077 -e 's/(?<!\w)::('"$type"')\b/$1/g' "$file" done }
handle_type c_void handle_type c_int handle_type c_uint handle_type c_char handle_type c_schar handle_type c_uchar handle_type c_short handle_type c_ushort handle_type c_long handle_type c_ulong handle_type c_longlong handle_type c_ulonglong handle_type c_float handle_type c_double handle_type size_t handle_type ssize_t handle_type intptr_t handle_type ptrdiff_t handle_type off_t handle_type off64_t handle_type Ioctl handle_type cmsghdr # To avoid "line formatted, but exceeded maximum width"
targets=( aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-macabi aarch64-apple-ios-sim aarch64-apple-tvos aarch64-apple-tvos-sim aarch64-apple-visionos aarch64-apple-visionos-sim aarch64-apple-watchos aarch64-apple-watchos-sim aarch64-kmc-solid_asp3 aarch64-linux-android aarch64-nintendo-switch-freestanding aarch64-pc-windows-gnullvm aarch64-pc-windows-msvc aarch64-unknown-freebsd aarch64-unknown-fuchsia aarch64-unknown-hermit aarch64-unknown-illumos aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu_ilp32 aarch64-unknown-linux-musl aarch64-unknown-linux-ohos aarch64-unknown-netbsd aarch64-unknown-none aarch64-unknown-none-softfloat aarch64-unknown-nto-qnx700 aarch64-unknown-nto-qnx710 aarch64-unknown-openbsd aarch64-unknown-redox #aarch64-unknown-teeos aarch64-unknown-trusty aarch64-unknown-uefi aarch64-uwp-windows-msvc aarch64-wrs-vxworks aarch64_be-unknown-linux-gnu aarch64_be-unknown-linux-gnu_ilp32 aarch64_be-unknown-netbsd arm-linux-androideabi arm-unknown-linux-gnueabi arm-unknown-linux-gnueabihf arm-unknown-linux-musleabi arm-unknown-linux-musleabihf arm64_32-apple-watchos arm64e-apple-darwin arm64e-apple-ios arm64e-apple-tvos arm64ec-pc-windows-msvc armeb-unknown-linux-gnueabi armebv7r-none-eabi armebv7r-none-eabihf armv4t-none-eabi armv4t-unknown-linux-gnueabi armv5te-none-eabi armv5te-unknown-linux-gnueabi armv5te-unknown-linux-musleabi armv5te-unknown-linux-uclibceabi armv6-unknown-freebsd armv6-unknown-netbsd-eabihf armv6k-nintendo-3ds armv7-linux-androideabi armv7-rtems-eabihf armv7-sony-vita-newlibeabihf armv7-unknown-freebsd armv7-unknown-linux-gnueabi armv7-unknown-linux-gnueabihf armv7-unknown-linux-musleabi armv7-unknown-linux-musleabihf armv7-unknown-linux-ohos armv7-unknown-linux-uclibceabi armv7-unknown-linux-uclibceabihf armv7-unknown-netbsd-eabihf armv7-unknown-trusty armv7-wrs-vxworks-eabihf armv7a-kmc-solid_asp3-eabi armv7a-kmc-solid_asp3-eabihf armv7a-none-eabi armv7a-none-eabihf armv7k-apple-watchos armv7r-none-eabi armv7r-none-eabihf armv7s-apple-ios armv8r-none-eabihf #avr-unknown-gnu-atmega328 bpfeb-unknown-none bpfel-unknown-none csky-unknown-linux-gnuabiv2 csky-unknown-linux-gnuabiv2hf hexagon-unknown-linux-musl #hexagon-unknown-none-elf i386-apple-ios #i586-pc-nto-qnx700 i586-pc-windows-msvc i586-unknown-linux-gnu i586-unknown-linux-musl i586-unknown-netbsd i686-apple-darwin i686-linux-android i686-pc-windows-gnu i686-pc-windows-gnullvm i686-pc-windows-msvc i686-unknown-freebsd i686-unknown-haiku i686-unknown-hurd-gnu i686-unknown-linux-gnu i686-unknown-linux-musl i686-unknown-netbsd i686-unknown-openbsd i686-unknown-redox i686-unknown-uefi i686-uwp-windows-gnu i686-uwp-windows-msvc i686-win7-windows-msvc i686-wrs-vxworks loongarch64-unknown-linux-gnu loongarch64-unknown-linux-musl loongarch64-unknown-linux-ohos loongarch64-unknown-none loongarch64-unknown-none-softfloat #m68k-unknown-linux-gnu mips-unknown-linux-gnu mips-unknown-linux-musl mips-unknown-linux-uclibc mips64-openwrt-linux-musl mips64-unknown-linux-gnuabi64 mips64-unknown-linux-muslabi64 mips64el-unknown-linux-gnuabi64 mips64el-unknown-linux-muslabi64 mipsel-sony-psp mipsel-sony-psx mipsel-unknown-linux-gnu mipsel-unknown-linux-musl mipsel-unknown-linux-uclibc mipsel-unknown-netbsd mipsel-unknown-none mipsisa32r6-unknown-linux-gnu mipsisa32r6el-unknown-linux-gnu mipsisa64r6-unknown-linux-gnuabi64 mipsisa64r6el-unknown-linux-gnuabi64 msp430-none-elf nvptx64-nvidia-cuda powerpc-unknown-freebsd powerpc-unknown-linux-gnu powerpc-unknown-linux-gnuspe powerpc-unknown-linux-musl powerpc-unknown-linux-muslspe powerpc-unknown-netbsd powerpc-unknown-openbsd powerpc-wrs-vxworks powerpc-wrs-vxworks-spe powerpc64-ibm-aix powerpc64-unknown-freebsd powerpc64-unknown-linux-gnu powerpc64-unknown-linux-musl powerpc64-unknown-openbsd powerpc64-wrs-vxworks powerpc64le-unknown-freebsd powerpc64le-unknown-linux-gnu powerpc64le-unknown-linux-musl riscv32-wrs-vxworks riscv32e-unknown-none-elf riscv32em-unknown-none-elf riscv32emc-unknown-none-elf riscv32gc-unknown-linux-gnu riscv32gc-unknown-linux-musl riscv32i-unknown-none-elf riscv32im-risc0-zkvm-elf riscv32im-unknown-none-elf riscv32ima-unknown-none-elf riscv32imac-esp-espidf riscv32imac-unknown-none-elf riscv32imac-unknown-nuttx-elf riscv32imac-unknown-xous-elf riscv32imafc-esp-espidf riscv32imafc-unknown-none-elf riscv32imafc-unknown-nuttx-elf riscv32imc-esp-espidf riscv32imc-unknown-none-elf riscv32imc-unknown-nuttx-elf riscv64-linux-android riscv64-wrs-vxworks riscv64gc-unknown-freebsd riscv64gc-unknown-fuchsia riscv64gc-unknown-hermit riscv64gc-unknown-linux-gnu riscv64gc-unknown-linux-musl #riscv64gc-unknown-netbsd riscv64gc-unknown-none-elf riscv64gc-unknown-nuttx-elf riscv64gc-unknown-openbsd riscv64imac-unknown-none-elf riscv64imac-unknown-nuttx-elf s390x-unknown-linux-gnu s390x-unknown-linux-musl sparc-unknown-linux-gnu sparc-unknown-none-elf sparc64-unknown-linux-gnu sparc64-unknown-netbsd sparc64-unknown-openbsd sparcv9-sun-solaris thumbv4t-none-eabi thumbv5te-none-eabi thumbv6m-none-eabi thumbv6m-nuttx-eabi thumbv7a-pc-windows-msvc thumbv7a-uwp-windows-msvc thumbv7em-none-eabi thumbv7em-none-eabihf thumbv7em-nuttx-eabi thumbv7em-nuttx-eabihf thumbv7m-none-eabi thumbv7m-nuttx-eabi thumbv7neon-linux-androideabi thumbv7neon-unknown-linux-gnueabihf thumbv7neon-unknown-linux-musleabihf thumbv8m.base-none-eabi thumbv8m.base-nuttx-eabi thumbv8m.main-none-eabi thumbv8m.main-none-eabihf thumbv8m.main-nuttx-eabi thumbv8m.main-nuttx-eabihf wasm32-unknown-emscripten wasm32-unknown-unknown wasm32-wasip1 wasm32-wasip1-threads wasm32-wasip2 wasm32v1-none wasm64-unknown-unknown x86_64-apple-darwin x86_64-apple-ios x86_64-apple-ios-macabi x86_64-apple-tvos x86_64-apple-watchos-sim x86_64-fortanix-unknown-sgx x86_64-linux-android x86_64-pc-nto-qnx710 x86_64-pc-solaris x86_64-pc-windows-gnu x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc x86_64-unikraft-linux-musl x86_64-unknown-dragonfly x86_64-unknown-freebsd x86_64-unknown-fuchsia x86_64-unknown-haiku x86_64-unknown-hermit x86_64-unknown-hurd-gnu x86_64-unknown-illumos x86_64-unknown-l4re-uclibc x86_64-unknown-linux-gnu x86_64-unknown-linux-gnux32 x86_64-unknown-linux-musl #x86_64-unknown-linux-none x86_64-unknown-linux-ohos x86_64-unknown-netbsd x86_64-unknown-none x86_64-unknown-openbsd x86_64-unknown-redox x86_64-unknown-trusty x86_64-unknown-uefi x86_64-uwp-windows-gnu x86_64-uwp-windows-msvc x86_64-win7-windows-msvc x86_64-wrs-vxworks x86_64h-apple-darwin #xtensa-esp32-espidf #xtensa-esp32-none-elf #xtensa-esp32s2-espidf #xtensa-esp32s2-none-elf #xtensa-esp32s3-espidf #xtensa-esp32s3-none-elf )
for target in "${targets[@]}"; do echo "Migrating 2015 -> 2018 target $target" cargo fix --target "$target" -Zbuild-std=core --features extra_traits --allow-dirty --edition --broken-code --lib done
freebsd_versions=(freebsd13 freebsd14 freebsd15) for ver in "${freebsd_versions[@]}"; do echo "Migrating 2015 -> 2018 $ver" RUSTFLAGS="--cfg $ver" cargo fix --target i686-unknown-freebsd -Zbuild-std=core --features extra_traits --allow-dirty --edition --broken-code --lib RUSTFLAGS="--cfg $ver" cargo fix --target x86_64-unknown-freebsd -Zbuild-std=core --features extra_traits --allow-dirty --edition --broken-code --lib done
perl -pi -077 -e 's/edition = "2015"/edition = "2018"/' Cargo.toml
for target in "${targets[@]}"; do echo "Migrating 2018 -> 2021 target $target" cargo fix --target "$target" -Zbuild-std=core --features extra_traits --allow-dirty --edition --broken-code --lib done
perl -pi -077 -e 's/edition = "2018"/edition = "2021"/' Cargo.toml
for target in "${targets[@]}"; do echo "Checking target $target" cargo check --target "$target" -Zbuild-std=core --features extra_traits --lib || { echo "Failed for target $target" exit 1 } done
for ver in "${freebsd_versions[@]}"; do echo "Checking $ver" RUSTFLAGS="--cfg $ver" cargo check --target i686-unknown-freebsd -Zbuild-std=core --features extra_traits --lib || { echo "Failed for i686 $freebsd_versions" exit 1 } RUSTFLAGS="--cfg $ver" cargo check --target x86_64-unknown-freebsd -Zbuild-std=core --features extra_traits || --lib { echo "Failed for x86_64 $freebsd_versions" exit 1 } done
ci/style.sh ```
(backport <https://github.com/rust-lang/libc/pull/4132>) (cherry picked from commit 20f6aa4c8135ba5e2c079ff21b20f0a1be87e1c4)
[ applied by rerunning the script rather than resolving conflicts. Also updated the script to fail on error and to pass `--lib` so `cargo fix` doesn't try to upgrade anything that requires `std`. -Trevor ]
show more ...
|
| b8ac8c8a | 23-Nov-2024 |
Eduardo Sánchez Muñoz <[email protected]> |
Fix `unused_qualifications`
(backport <https://github.com/rust-lang/libc/pull/4132>) (cherry picked from commit 65e7837345c21477ffcd4c1d4865b693323d15f6) |