diff --git a/libc-test/build.rs b/libc-test/build.rs index 6541fd5bd5801..03d0b55b392b7 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -315,9 +315,6 @@ fn test_openbsd(target: &str) { match name { "execv" | "execve" | "execvp" | "execvpe" => true, - // typed 2nd arg - "gettimeofday" => true, - // Removed in OpenBSD 6.5 // https://marc.info/?l=openbsd-cvs&m=154723400730318 "mincore" => true, @@ -1113,9 +1110,8 @@ fn test_dragonflybsd(target: &str) { "getrlimit" | "getrlimit64" | // non-int in 1st arg "setrlimit" | "setrlimit64" | // non-int in 1st arg - "prlimit" | "prlimit64" | // non-int in 2nd arg - // typed 2nd arg on linux - "gettimeofday" => true, + "prlimit" | "prlimit64" // non-int in 2nd arg + => true, _ => false, } @@ -1461,10 +1457,6 @@ fn test_android(target: &str) { "execvpe" | "fexecve" => true, - // typed 2nd arg on android - // FIXME: still necessary? - "gettimeofday" => true, - // not declared in newer android toolchains // FIXME: still necessary? "getdtablesize" => true, @@ -1815,9 +1807,6 @@ fn test_freebsd(target: &str) { "execvpe" | "fexecve" => true, - // FIXME: for some reason, our signature is wrong - "gettimeofday" => true, - // The `uname` function in freebsd is now an inline wrapper that // delegates to another, but the symbol still exists, so don't check // the symbol. @@ -2701,10 +2690,6 @@ fn test_linux(target: &str) { // FIXME: is this necessary? "sendmmsg" | "recvmmsg" if musl => true, - // typed 2nd arg on linux - // FIXME: is this necessary? - "gettimeofday" => true, - // FIXME: is this necessary? "dladdr" if musl => true, // const-ness only added recently diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 9483e90b62458..53463abbc8e23 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3045,6 +3045,8 @@ extern { pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getutxent() -> *mut utmpx; pub fn getutxid(ut: *const utmpx) -> *mut utmpx; pub fn getutxline(ut: *const utmpx) -> *mut utmpx; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 7a82a45e13f6b..5e0853bf51360 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1095,7 +1095,8 @@ extern { -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index ad53c19b3b6ad..d4ccd6775a5bd 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1492,6 +1492,9 @@ extern { #[link_name = "__lutimes50"] pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; + #[link_name = "__gettimeofday50"] + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index 223064b76eea4..bd20164b20a11 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -895,6 +895,8 @@ f! { } extern { + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int; pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int; pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_uint, diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 26519a4770d8e..8eb8bffc3da5f 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1264,7 +1264,8 @@ extern { errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); - + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; diff --git a/src/unix/hermit/mod.rs b/src/unix/hermit/mod.rs index 288cc46a50693..583056bac4bda 100644 --- a/src/unix/hermit/mod.rs +++ b/src/unix/hermit/mod.rs @@ -981,6 +981,8 @@ extern { pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 1565b6338c121..b85a27108926f 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -849,17 +849,6 @@ extern { pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")] - #[deprecated( - since="0.2.54", - note= - "The signature of this function is incorrect. \ - If you are using it, please report that in the following issue \ - so that we can evaluate the impact of fixing it: \ - https://github.com/rust-lang/libc/issues/1338" - )] - pub fn gettimeofday(tp: *mut ::timeval, - tz: *mut ::c_void) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__times13")] pub fn times(buf: *mut ::tms) -> ::clock_t; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index c9a25a35d41e5..ea52ff560ad93 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -623,6 +623,8 @@ extern { pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r(gid: ::gid_t, grp: *mut ::group, diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index a430b1a00d5ef..46dd6092402a1 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -1924,6 +1924,8 @@ extern { } extern { + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; diff --git a/src/unix/notbsd/emscripten/mod.rs b/src/unix/notbsd/emscripten/mod.rs index 0f8c76e3ab6d0..8521d5dc4cb84 100644 --- a/src/unix/notbsd/emscripten/mod.rs +++ b/src/unix/notbsd/emscripten/mod.rs @@ -1689,6 +1689,9 @@ extern { pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; + pub fn setpwent(); pub fn endpwent(); pub fn getpwent() -> *mut passwd; diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs index eeb33b9901401..f230064c9e248 100644 --- a/src/unix/notbsd/linux/musl/mod.rs +++ b/src/unix/notbsd/linux/musl/mod.rs @@ -325,6 +325,8 @@ pub const SO_PEEK_OFF: ::c_int = 42; pub const SO_BUSY_POLL: ::c_int = 46; extern { + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn ptrace(request: ::c_int, ...) -> ::c_long; pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 8ebbfbb03b87d..f41047437598d 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -918,6 +918,8 @@ extern { pub fn endutxent(); pub fn getpt() -> ::c_int; pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; } #[link(name = "util")] diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index d0905e11ffd79..6b8adba4e74ea 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1265,7 +1265,6 @@ extern { pshared: ::c_int, value: ::c_uint) -> ::c_int; - pub fn fdatasync(fd: ::c_int) -> ::c_int; pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int; diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 4bb1ab4ba4579..9f22ca2022345 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -584,5 +584,7 @@ extern { iovcnt: ::c_int) -> ::ssize_t; // time.h + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 1092d152dea75..887cfc347bc54 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1800,6 +1800,8 @@ extern { pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ::ifaddrs); diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index e3baba0614ebb..4cb430b15f9c3 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -1500,6 +1500,8 @@ extern { pub fn srand(seed: ::c_uint); pub fn fdatasync(fd: ::c_int) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;