Skip to content

[0.2] Backports #4378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
14beec8
cygwin: add statfs & fcntl
Berrysoft Mar 11, 2025
56330cd
linux: Add new netlink flags
jbaublitz Feb 27, 2025
c107c77
linux: Added _IO, _IOW, _IOR, _IOWR to the exported API
Mr2Brainless Mar 11, 2025
9d7c71c
cygwin: fix member types of statfs
Berrysoft Mar 12, 2025
f630218
Add more error codes for VxWorks
hax0kartik Mar 18, 2025
b28fef8
Add some missing functions
hax0kartik Mar 18, 2025
bbb331a
seccomp: Add more constants from seccomp.h
mbuesch Mar 14, 2025
20a99de
ci: install musl from source for loongarch64
heiher Mar 11, 2025
5a1f5f2
feat: Add tcp_info to Linux uClibc bindings
b-parikh Mar 21, 2025
c271bff
musl: enable `getrandom` on all musl platforms
tamird Mar 20, 2025
bce5fbd
hermit: add `AF_UNSPEC`
mkroening Mar 20, 2025
7a882bf
hermit: add `AF_VSOCK`
mkroening Mar 20, 2025
c40de72
hermit: make `AF_INET = 3`
mkroening Mar 20, 2025
de18637
android: Add getauxval for 32-bit targets
taiki-e Mar 18, 2025
2480f37
adding secure_getenv for solaris/illumos.
devnexen Mar 19, 2025
b56ee81
Remove RTLD_DEEPBIND. It's a glibc extension and not supported by musl.
12101111 Mar 16, 2025
0637411
Fix the value of SA_ONSTACK
12101111 Mar 16, 2025
2d5b81a
Fix syscall table
12101111 Mar 16, 2025
de07194
Remove O_FSYNC, musl don't define it. Use O_SYNC instead.
12101111 Mar 16, 2025
05df979
temporarily define O_DIRECT and SIGINFO for Solaris
psumbera Mar 21, 2025
5f8ac01
Fix typo in waitpid parameter name
jimmycathy Mar 16, 2025
029aa40
Add more signal constants for NuttX
no1wudi Mar 25, 2025
e8a4bdf
Add new socket options for cygwin
Berrysoft Mar 24, 2025
02741e0
Add missing Signal related consts
hax0kartik Mar 25, 2025
5875016
Add missing d_type member in dirent struct
hax0kartik Mar 25, 2025
f05f950
Fix test on cygwin
Berrysoft Mar 30, 2025
17c585a
linux: add missing pthread_attr_setstack
terohuttunen Mar 22, 2025
cb50c4a
Add timerfd APIs for illumos and NetBSD.
sunfishcode Mar 16, 2025
8e5fa76
solarish: restrict openpty and forkpty polyfills to illumos, replace …
yuvraj-wale Mar 13, 2025
aa9eab3
linux: add missing tls bindings
mbyx Mar 4, 2025
2a9260f
Add: missing INPUT_PROP_XXX flags from input-event-codes.h
yuvraj-wale Mar 12, 2025
19ee58a
adding further BPF program flags for Linux.
devnexen Mar 29, 2025
411f298
Always deny warnings in CI
tgross35 Apr 3, 2025
f202ec4
Ensure the makedev test does not emit unused errors
tgross35 Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ on:
- libc-0.2

env:
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: true
LIBC_CI: 1
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: full

defaults:
run:
Expand Down Expand Up @@ -42,6 +46,12 @@ jobs:
TOOLCHAIN: ${{ matrix.toolchain }}
steps:
- uses: actions/checkout@v4
# Remove `-Dwarnings` at the MSRV since lints may be different or buffier
- name: Update RUSTFLAGS
run: |
set -eux
[ "${{ matrix.toolchain }}" = "1.63.0" ] && echo 'RUSTFLAGS=' >> "$GITHUB_ENV" || true

- name: Setup Rust toolchain
run: ./ci/install-rust.sh

Expand Down
16 changes: 9 additions & 7 deletions ci/docker/loongarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM ubuntu:24.10

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl gcc git libc6-dev make qemu-user xz-utils
ca-certificates curl gcc gcc-14-loongarch64-linux-gnu git libc6-dev \
make qemu-user xz-utils patch rsync

COPY install-musl-cross.sh /
RUN /install-musl-cross.sh loongarch64-unknown-linux-musl
COPY install-musl.sh /
RUN /install-musl.sh loongarch64

ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \
CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \
CC_loongarch64_unknown_linux_musl=musl-gcc \
CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \
QEMU_LD_PREFIX=/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot \
PATH=$PATH:/loongarch64-unknown-linux-musl/bin:/rust/bin
RUSTFLAGS="-Ctarget-feature=+crt-static" \
QEMU_LD_PREFIX=/musl-loongarch64 \
PATH=$PATH:/musl-loongarch64/bin:/rust/bin
10 changes: 0 additions & 10 deletions ci/install-musl-cross.sh

This file was deleted.

17 changes: 16 additions & 1 deletion ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@

set -eux

musl_version=1.1.24
case ${1} in
loongarch64)
musl_version=1.2.5
;;
*)
musl_version=1.1.24
;;
esac

musl="musl-${musl_version}"

# Download, configure, build, and install musl:
Expand Down Expand Up @@ -53,6 +61,13 @@ case ${1} in
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
loongarch64)
musl_arch=loongarch64
kernel_arch=loongarch
CC=loongarch64-linux-gnu-gcc-14 \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
*)
echo "Unknown target arch: \"${1}\""
exit 1
Expand Down
7 changes: 3 additions & 4 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ description = """
A test crate for the libc crate.
"""

[dependencies.libc]
path = ".."
version = "0.2.171"
default-features = false
[dependencies]
cfg-if = "1.0.0"
libc = { path = "..", version = "0.2.171", default-features = false }

[dev-dependencies]
syn = { version = "2.0.91", features = ["full", "visit"] }
Expand Down
22 changes: 18 additions & 4 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn src_hotfix_dir() -> PathBuf {

fn do_cc() {
let target = env::var("TARGET").unwrap();
if cfg!(unix) {
if cfg!(unix) || target.contains("cygwin") {
let exclude = ["redox", "wasi", "wali"];
if !exclude.iter().any(|x| target.contains(x)) {
let mut cmsg = cc::Build::new();
Expand Down Expand Up @@ -700,6 +700,7 @@ fn test_cygwin(target: &str) {
"dlfcn.h",
"errno.h",
"fcntl.h",
"fnmatch.h",
"grp.h",
"iconv.h",
"langinfo.h",
Expand All @@ -710,11 +711,13 @@ fn test_cygwin(target: &str) {
"netinet/tcp.h",
"poll.h",
"pthread.h",
"pty.h",
"pwd.h",
"resolv.h",
"sched.h",
"semaphore.h",
"signal.h",
"spawn.h",
"stddef.h",
"stdlib.h",
"string.h",
Expand All @@ -734,6 +737,7 @@ fn test_cygwin(target: &str) {
"sys/uio.h",
"sys/un.h",
"sys/utsname.h",
"sys/vfs.h",
"syslog.h",
"termios.h",
"unistd.h",
Expand Down Expand Up @@ -853,7 +857,7 @@ fn test_cygwin(target: &str) {
}
});

cfg.generate("../src/lib.rs", "main.rs");
cfg.generate(src_hotfix_dir().join("lib.rs"), "main.rs");
}

fn test_windows(target: &str) {
Expand Down Expand Up @@ -1049,6 +1053,13 @@ fn test_solarish(target: &str) {
cfg.define("__EXTENSIONS__", None);
cfg.define("_LCONV_C99", None);

// FIXME(solaris): This should be removed once new Nix crate is released.
// See comment in src/unix/solarish/solaris.rs for these.
if is_solaris {
cfg.define("O_DIRECT", Some("0x2000000"));
cfg.define("SIGINFO", Some("41"));
}

headers! {
cfg:
"aio.h",
Expand Down Expand Up @@ -1307,6 +1318,10 @@ fn test_solarish(target: &str) {
// https://github.com/gnzlbg/ctest/issues/68
"lio_listio" => true,

// Exists on illumos too but, for now, is
// [a recent addition](https://www.illumos.org/issues/17094).
"secure_getenv" if is_illumos => true,

_ => false,
}
});
Expand Down Expand Up @@ -4136,8 +4151,7 @@ fn test_linux(target: &str) {
"epoll_params" => true,

// FIXME(linux): Requires >= 6.12 kernel headers.
"dmabuf_cmsg" |
"dmabuf_token" => true,
"dmabuf_cmsg" | "dmabuf_token" => true,

_ => false,
}
Expand Down
14 changes: 14 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1793,8 +1793,11 @@ NLMSG_MIN_TYPE
NLMSG_NOOP
NLMSG_OVERRUN
NLM_F_ACK
NLM_F_ACK_TLVS
NLM_F_APPEND
NLM_F_ATOMIC
NLM_F_BULK
NLM_F_CAPPED
NLM_F_CREATE
NLM_F_DUMP
NLM_F_DUMP_FILTERED
Expand All @@ -1803,6 +1806,7 @@ NLM_F_ECHO
NLM_F_EXCL
NLM_F_MATCH
NLM_F_MULTI
NLM_F_NONREC
NLM_F_REPLACE
NLM_F_REQUEST
NLM_F_ROOT
Expand Down Expand Up @@ -2222,10 +2226,16 @@ SCM_CREDENTIALS
SCM_RIGHTS
SCM_TIMESTAMP
SCM_TIMESTAMPING
SECCOMP_ADDFD_FLAG_SEND
SECCOMP_ADDFD_FLAG_SETFD
SECCOMP_FILTER_FLAG_LOG
SECCOMP_FILTER_FLAG_NEW_LISTENER
SECCOMP_FILTER_FLAG_SPEC_ALLOW
SECCOMP_FILTER_FLAG_TSYNC
SECCOMP_FILTER_FLAG_TSYNC_ESRCH
SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV
SECCOMP_GET_ACTION_AVAIL
SECCOMP_GET_NOTIF_SIZES
SECCOMP_MODE_DISABLED
SECCOMP_MODE_FILTER
SECCOMP_MODE_STRICT
Expand All @@ -2241,6 +2251,9 @@ SECCOMP_RET_LOG
SECCOMP_RET_TRACE
SECCOMP_RET_TRAP
SECCOMP_RET_USER_NOTIF
SECCOMP_SET_MODE_FILTER
SECCOMP_SET_MODE_STRICT
SECCOMP_USER_NOTIF_FLAG_CONTINUE
SEEK_CUR
SEEK_DATA
SEEK_END
Expand Down Expand Up @@ -3325,6 +3338,7 @@ fwrite_unlocked
gai_strerror
genlmsghdr
getaddrinfo
getauxval
getchar
getchar_unlocked
getcwd
Expand Down
Loading
Loading