From c0fab38966c775c6f92492011292febdca2bd3fa Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Mon, 13 Aug 2018 13:30:49 -0500 Subject: [PATCH] NetBSD: correct link_name of some time-related functions The futimes(), lutimes(), mq_timedreceive(), and mq_timedsend() functions were linking against legacy library symbols that need 32-bit time_t in structures, resulting in an ABI mismatch with 64-bit time_t. --- src/unix/bsd/mod.rs | 1 + src/unix/bsd/netbsdlike/netbsd/mod.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 47f82bdf..03ab3192 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -444,6 +444,7 @@ extern { flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::ssize_t; pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__futimes50")] pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 917593ee..b343c3a1 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1004,6 +1004,7 @@ extern { pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent) -> ::c_int; + #[link_name = "__lutimes50"] pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, @@ -1055,11 +1056,13 @@ extern { pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int; + #[link_name = "__mq_timedreceive50"] pub fn mq_timedreceive(mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msq_prio: *mut ::c_uint, abs_timeout: *const ::timespec) -> ::ssize_t; + #[link_name = "__mq_timedsend50"] pub fn mq_timedsend(mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t,