Skip to content
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

[0.2] Backports #3982

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn test_apple(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"glob.h",
"grp.h",
Expand Down Expand Up @@ -482,6 +483,7 @@ fn test_openbsd(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"libgen.h",
"limits.h",
Expand Down Expand Up @@ -793,6 +795,7 @@ fn test_redox(target: &str) {
"dlfcn.h",
"errno.h",
"fcntl.h",
"fnmatch.h",
"grp.h",
"limits.h",
"locale.h",
Expand Down Expand Up @@ -852,6 +855,7 @@ fn test_solarish(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"glob.h",
"grp.h",
Expand Down Expand Up @@ -1092,6 +1096,7 @@ fn test_netbsd(target: &str) {
"elf.h",
"errno.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"libgen.h",
"limits.h",
Expand Down Expand Up @@ -1308,6 +1313,7 @@ fn test_dragonflybsd(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"glob.h",
"grp.h",
Expand Down Expand Up @@ -1531,6 +1537,7 @@ fn test_wasi(target: &str) {
"dirent.h",
"errno.h",
"fcntl.h",
"fnmatch.h",
"langinfo.h",
"limits.h",
"locale.h",
Expand Down Expand Up @@ -1646,6 +1653,7 @@ fn test_android(target: &str) {
"elf.h",
"errno.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"grp.h",
"ifaddrs.h",
Expand Down Expand Up @@ -2145,6 +2153,7 @@ fn test_freebsd(target: &str) {
"errno.h",
"execinfo.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"glob.h",
"grp.h",
Expand Down Expand Up @@ -2762,6 +2771,7 @@ fn test_emscripten(target: &str) {
"dlfcn.h",
"errno.h",
"fcntl.h",
"fnmatch.h",
"glob.h",
"grp.h",
"ifaddrs.h",
Expand Down Expand Up @@ -3030,6 +3040,7 @@ fn test_neutrino(target: &str) {
"dlfcn.h",
"sys/elf.h",
"fcntl.h",
"fnmatch.h",
"glob.h",
"grp.h",
"iconv.h",
Expand Down Expand Up @@ -3427,6 +3438,7 @@ fn test_linux(target: &str) {
"dlfcn.h",
"elf.h",
"fcntl.h",
"fnmatch.h",
"getopt.h",
"glob.h",
[gnu]: "gnu/libc-version.h",
Expand Down
52 changes: 26 additions & 26 deletions libc-test/semver/linux-musl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ AF_XDP
AIO_ALLDONE
AIO_CANCELED
AIO_NOTCANCELED
MPOL_BIND
MPOL_DEFAULT
MPOL_INTERLEAVE
MPOL_LOCAL
MPOL_PREFERRED
BOOT_TIME
DEAD_PROCESS
EMPTY
Elf32_Chdr
Elf64_Chdr
EMPTY
INIT_PROCESS
LIO_NOP
LIO_NOWAIT
LIO_READ
LIO_WAIT
LIO_WRITE
LOGIN_PROCESS
MPOL_BIND
MPOL_DEFAULT
MPOL_INTERLEAVE
MPOL_LOCAL
MPOL_PREFERRED
NEW_TIME
OLD_TIME
PF_IB
Expand All @@ -37,29 +37,29 @@ RWF_NOWAIT
RWF_SYNC
SOL_XDP
USER_PROCESS
XDP_SHARED_UMEM
XDP_COPY
XDP_ZEROCOPY
XDP_USE_NEED_WAKEUP
XDP_USE_SG
XDP_UMEM_UNALIGNED_CHUNK_FLAG
XDP_RING_NEED_WAKEUP
XDP_MMAP_OFFSETS
XDP_RX_RING
XDP_TX_RING
XDP_UMEM_REG
XDP_UMEM_FILL_RING
XDP_UMEM_COMPLETION_RING
XDP_STATISTICS
XDP_OPTIONS
XDP_OPTIONS_ZEROCOPY
XDP_PGOFF_RX_RING
XDP_PGOFF_TX_RING
XDP_UMEM_PGOFF_FILL_RING
XDP_PKT_CONTD
XDP_RING_NEED_WAKEUP
XDP_RX_RING
XDP_SHARED_UMEM
XDP_STATISTICS
XDP_TX_RING
XDP_UMEM_COMPLETION_RING
XDP_UMEM_FILL_RING
XDP_UMEM_PGOFF_COMPLETION_RING
XSK_UNALIGNED_BUF_OFFSET_SHIFT
XDP_UMEM_PGOFF_FILL_RING
XDP_UMEM_REG
XDP_UMEM_UNALIGNED_CHUNK_FLAG
XDP_USE_NEED_WAKEUP
XDP_USE_SG
XDP_ZEROCOPY
XSK_UNALIGNED_BUF_ADDR_MASK
XDP_PKT_CONTD
XSK_UNALIGNED_BUF_OFFSET_SHIFT
adjtimex
aio_cancel
aio_error
Expand All @@ -69,9 +69,14 @@ aio_return
aio_suspend
aio_write
aiocb
asctime_r
basename
clock_adjtime
copy_file_range
ctermid
dirname
eaccess
euidaccess
explicit_bzero
futimes
getauxval
Expand All @@ -92,8 +97,3 @@ pwritev64
reallocarray
tcp_info
timex
euidaccess
eaccess
asctime_r
dirname
basename
6 changes: 6 additions & 0 deletions libc-test/semver/unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ FD_ZERO
FILE
FIOCLEX
FIONBIO
FNM_CASEFOLD
FNM_NOESCAPE
FNM_NOMATCH
FNM_PATHNAME
FNM_PERIOD
F_DUPFD
F_DUPFD_CLOEXEC
F_GETFD
Expand Down Expand Up @@ -525,6 +530,7 @@ fgetpos
fgets
fileno
flock
fnmatch
fopen
fork
fpathconf
Expand Down
22 changes: 22 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,24 @@ pub const ATF_PERM: ::c_int = 0x04;
pub const ATF_PUBL: ::c_int = 0x08;
pub const ATF_USETRAILERS: ::c_int = 0x10;

pub const FNM_PERIOD: c_int = 1 << 2;
pub const FNM_CASEFOLD: c_int = 1 << 4;
pub const FNM_NOMATCH: c_int = 1;

cfg_if! {
if #[cfg(any(
target_os = "macos",
target_os = "freebsd",
target_os = "android",
))] {
pub const FNM_PATHNAME: c_int = 1 << 1;
pub const FNM_NOESCAPE: c_int = 1 << 0;
} else {
pub const FNM_PATHNAME: c_int = 1 << 0;
pub const FNM_NOESCAPE: c_int = 1 << 1;
}
}

extern "C" {
pub static in6addr_loopback: in6_addr;
pub static in6addr_any: in6_addr;
Expand Down Expand Up @@ -1580,6 +1598,10 @@ cfg_if! {
}
}

extern "C" {
pub fn fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int;
}

cfg_if! {
if #[cfg(target_env = "newlib")] {
mod newlib;
Expand Down