diff --git a/libc-test/build.rs b/libc-test/build.rs index d5bf3ea61ba39..08c07e6776131 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -204,6 +204,7 @@ fn test_apple(target: &str) { "iconv.h", "ifaddrs.h", "langinfo.h", + "libgen.h", "libproc.h", "limits.h", "locale.h", @@ -417,6 +418,7 @@ fn test_openbsd(target: &str) { "errno.h", "execinfo.h", "fcntl.h", + "libgen.h", "limits.h", "link.h", "locale.h", @@ -992,6 +994,7 @@ fn test_netbsd(target: &str) { "elf.h", "errno.h", "fcntl.h", + "libgen.h", "limits.h", "link.h", "locale.h", @@ -1206,6 +1209,7 @@ fn test_dragonflybsd(target: &str) { "ifaddrs.h", "kvm.h", "langinfo.h", + "libgen.h", "limits.h", "link.h", "locale.h", @@ -1505,6 +1509,7 @@ fn test_android(target: &str) { "fcntl.h", "grp.h", "ifaddrs.h", + "libgen.h", "limits.h", "link.h", "locale.h", @@ -1866,6 +1871,7 @@ fn test_freebsd(target: &str) { "iconv.h", "ifaddrs.h", "langinfo.h", + "libgen.h", "libutil.h", "limits.h", "link.h", @@ -2771,6 +2777,7 @@ fn test_linux(target: &str) { "iconv.h", "ifaddrs.h", "langinfo.h", + "libgen.h", "limits.h", "link.h", "locale.h", diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index d5d9fc5600ee6..6445af0264b56 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -3548,3 +3548,5 @@ winsize wmemchr write writev +dirname +basename \ No newline at end of file diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 723541817468c..95af36bbb41f7 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -2227,3 +2227,5 @@ wait4 waitid xsw_usage xucred +dirname +basename \ No newline at end of file diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index fa472ce662747..f8f0fa08915a8 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -1546,3 +1546,5 @@ wait4 waitid xucred eaccess +dirname +basename diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 649ef77161524..09bda1f2dd64f 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1925,4 +1925,6 @@ wait4 waitid xallocx xucred -eaccess \ No newline at end of file +eaccess +dirname +basename \ No newline at end of file diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index a4289ad8496cf..deec042d59780 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -657,4 +657,6 @@ eaccess asctime_r ctime_r strftime -strptime \ No newline at end of file +strptime +dirname +basename \ No newline at end of file diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index c00934af108e2..7af14189312d1 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -52,4 +52,6 @@ euidaccess eaccess asctime_r strftime -strptime \ No newline at end of file +strptime +dirname +basename \ No newline at end of file diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index f14f2eae45775..97d76cb3049d2 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1533,3 +1533,5 @@ uucred vm_size_t wait4 waitid +dirname +basename \ No newline at end of file diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index 0ae23f549bd26..d540671e1b037 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -1231,3 +1231,5 @@ utmp utrace wait4 xucred +dirname +basename \ No newline at end of file diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 8a7e2f1f09e01..6b391893a3bcd 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -5870,6 +5870,9 @@ extern "C" { pub fn malloc_size(ptr: *const ::c_void) -> ::size_t; pub fn malloc_good_size(size: ::size_t) -> ::size_t; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + pub fn basename(path: *mut ::c_char) -> *mut ::c_char; } pub unsafe fn mach_task_self() -> ::mach_port_t { diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 96818616b2c6f..70fe6e2edd03b 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1663,6 +1663,9 @@ extern "C" { pub fn umtx_sleep(ptr: *const ::c_int, value: ::c_int, timeout: ::c_int) -> ::c_int; pub fn umtx_wakeup(ptr: *const ::c_int, count: ::c_int) -> ::c_int; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + pub fn basename(path: *mut ::c_char) -> *mut ::c_char; } #[link(name = "rt")] diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index f34b24c579a45..e52e0fd338acf 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -4356,6 +4356,9 @@ extern "C" { uaddr: *mut ::c_void, uaddr2: *mut ::c_void, ) -> ::c_int; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + pub fn basename(path: *const ::c_char) -> *mut ::c_char; } #[link(name = "kvm")] diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 6c2096b1d9acf..b71531c253db1 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -743,6 +743,9 @@ extern "C" { pub fn gethostid() -> ::c_long; pub fn sethostid(hostid: ::c_long) -> ::c_int; pub fn ftok(path: *const ::c_char, id: ::c_int) -> ::key_t; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + pub fn basename(path: *mut ::c_char) -> *mut ::c_char; } cfg_if! { diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 67e5eb52b4e60..683a4c3ef9ae1 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -3227,6 +3227,9 @@ extern "C" { pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void; pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int; + + pub fn dirname(path: *const ::c_char) -> *mut ::c_char; + pub fn basename(path: *const ::c_char) -> *mut ::c_char; } cfg_if! { diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 3506d922ddf74..b6cc36a588f8b 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1346,6 +1346,9 @@ extern "C" { tm: *const ::tm, ) -> ::size_t; pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + pub fn basename(path: *mut ::c_char) -> *mut ::c_char; } extern "C" { diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 32d35782187f8..25291c2306115 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -767,6 +767,9 @@ extern "C" { tm: *const ::tm, ) -> ::size_t; pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + pub fn basename(path: *mut ::c_char) -> *mut ::c_char; } cfg_if! {