libc
libc copied to clipboard
adding aligned_alloc support for the following:
- linux glibc/musl.
- all supported BSD implements it.
- apple.
- solarish.
close #3689
r? @JohnTitor
rustbot has assigned @JohnTitor. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
Some changes occurred in solarish module
cc @jclulow, @pfmooney
@devnexen , @JohnTitor , CI is failing in main, and I have some observations.
I made PR https://github.com/rust-lang/libc/pull/3693 . All checks have passed at some point in interval 11 May 00:28 - 01:29 UTC, so I assume main ( 8b9d1feea295e92012c44eb17adb4c1d40a61ba0 ) was okay at that time.
But then at 11 May 18:56 UTC I noticed that very same commit in main ( 8b9d1feea295e92012c44eb17adb4c1d40a61ba0 ) has failing CI with platform sparc64-unknown-linux-gnu.
So it seems some external resource was updated, and it broke CI
the sparc container tends to fail from time to time (e.g. timeout)
@devnexen , sparc64 is broken for two days. As you can see, in all PRs for last two days sparc64 did not success.
Also, CI result in this very PR ( https://github.com/rust-lang/libc/pull/3698 ), says qemu-system-sparc64: terminating on signal 15 from pid 1165 (timeout), but also says /prog: /lib/sparc64-linux-gnu/libm.so.6: version GLIBC_2.38 not found (required by /prog)
( https://github.com/rust-lang/libc/actions/runs/9052276084/job/24869832722?pr=3698 )
It looks like this is available just about everywhere nowadays:
- linux glibc https://github.com/bminor/glibc/blob/b22923abb046311ac9097a36b97b9b97342bac44/stdlib/stdlib.h#L724
- linux musl https://github.com/kraj/musl/blob/2c41ee96f60074fa8ac387e1fcdedba0654fb173/include/stdlib.h#L44
- linux ulibc https://github.com/wbx-github/uclibc-ng/blob/ecbc412d0d93c8b7b77bec6539b290c9da5401cf/include/stdlib.h#L536
- newlib https://github.com/reswitched/newlib/blob/76f6d4e21ed5b621adb75fe99a69704dca831177/newlib/libc/stdlib/aligned_alloc.c#L30
- openbsd https://github.com/openbsd/src/blob/fd042ffdc70d1726d6308c4819514edac16eff53/lib/libc/stdlib/malloc.c#L2342-L2343
- netbsd https://man.netbsd.org/aligned_alloc.3
- freebsd https://man.freebsd.org/cgi/man.cgi?query=aligned_alloc&apropos=0&sektion=3&manpath=FreeBSD+9-current&format=html
- redox https://github.com/redox-os/relibc/blob/a38638542d0f7b0063da3c84833bd72c0f71da88/src/header/stdlib/mod.rs#L122
- haiku https://github.com/haiku/haiku/blob/ba4478ce60f4c0c3f00697981fc87d4e9e66b230/headers/posix/stdlib.h#L52
- aix (well z/os, but I assume they would be the same) https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-aligned-alloc-allocating-aligned-memory-blocks
- nto/qnx https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.lib_ref/topic/a/aligned_alloc.html
I can't find the Apple docs, but it seems like this is available in more recent versions. So could this just go in unix/mod.rs?
Also please target main and update the commit message with the changes.
@rustbot author
closed in favor of #3843