diff --git a/src/header/arpa_inet/mod.rs b/src/header/arpa_inet/mod.rs index 838f71f2ff..e982353f71 100644 --- a/src/header/arpa_inet/mod.rs +++ b/src/header/arpa_inet/mod.rs @@ -145,7 +145,10 @@ pub extern "C" fn inet_netof(r#in: in_addr) -> in_addr_t { #[deprecated] #[unsafe(no_mangle)] pub unsafe extern "C" fn inet_network(cp: *const c_char) -> in_addr_t { - ntohl(unsafe { inet_addr(cp) }) + ntohl(unsafe { + #[allow(deprecated)] + inet_addr(cp) + }) } /// See . diff --git a/src/header/netdb/mod.rs b/src/header/netdb/mod.rs index 72ca178836..424270b907 100644 --- a/src/header/netdb/mod.rs +++ b/src/header/netdb/mod.rs @@ -348,7 +348,10 @@ pub unsafe extern "C" fn gethostbyname(name: *const c_char) -> *mut hostent { // Some implementations just skip resolution and copy the address to h_name if let Some(s_addr) = parse_ipv4_string(name_str) { let addr = in_addr { s_addr }; - return unsafe { gethostbyaddr(ptr::from_ref(&addr).cast::(), 4, AF_INET) }; + return unsafe { + #[allow(deprecated)] + gethostbyaddr(ptr::from_ref(&addr).cast::(), 4, AF_INET) + }; } // check the hosts file first @@ -1137,6 +1140,7 @@ pub extern "C" fn herror(prefix: *const c_char) { let code = H_ERRNO.get(); // Safety: `hstrerror` handles every error code case and always returns a valid C string let error = unsafe { + #[allow(deprecated)] let msg_cstr = CStr::from_ptr(hstrerror(code)); str::from_utf8_unchecked(msg_cstr.to_bytes()) }; diff --git a/src/header/stdio/mod.rs b/src/header/stdio/mod.rs index 0ece8d2ed8..a1d43be6c4 100644 --- a/src/header/stdio/mod.rs +++ b/src/header/stdio/mod.rs @@ -1299,7 +1299,12 @@ pub unsafe extern "C" fn tempnam(dir: *const c_char, pfx: *const c_char) -> *mut }; // use the same mechanism as tmpnam to get the file name - if unsafe { tmpnam_inner(out_buf, dirname_len + 1 + prefix_len) }.is_null() { + if unsafe { + #[allow(deprecated)] + tmpnam_inner(out_buf, dirname_len + 1 + prefix_len) + } + .is_null() + { // failed to find a valid file name, so we need to free the buffer unsafe { platform::free(out_buf.cast()) }; out_buf = ptr::null_mut(); @@ -1346,7 +1351,10 @@ pub unsafe extern "C" fn tmpnam(s: *mut c_char) -> *mut c_char { }; unsafe { *buf = b'/' as _ }; - unsafe { tmpnam_inner(buf, 1) } + unsafe { + #[allow(deprecated)] + tmpnam_inner(buf, 1) + } } #[deprecated] @@ -1359,7 +1367,10 @@ unsafe extern "C" fn tmpnam_inner(buf: *mut c_char, offset: usize) -> *mut c_cha }; let err = platform::ERRNO.get(); - unsafe { stdlib::mktemp(buf) }; + unsafe { + #[allow(deprecated)] + stdlib::mktemp(buf) + }; platform::ERRNO.set(err); if unsafe { *buf } == 0 { diff --git a/src/header/sys_time/mod.rs b/src/header/sys_time/mod.rs index 152f145318..43b27324a9 100644 --- a/src/header/sys_time/mod.rs +++ b/src/header/sys_time/mod.rs @@ -69,6 +69,7 @@ pub struct timezone { /// The `getitimer()` function was marked obsolescent in the Open Group Base /// Specifications Issue 7, and removed in Issue 8. #[deprecated] +#[allow(deprecated)] #[unsafe(no_mangle)] pub unsafe extern "C" fn getitimer(which: c_int, value: *mut itimerval) -> c_int { Sys::getitimer(which, unsafe { &mut *value }) @@ -100,6 +101,7 @@ pub unsafe extern "C" fn gettimeofday(tp: *mut timeval, tzp: *mut timezone) -> c /// The `setitimer()` function was marked obsolescent in the Open Group Base /// Specifications Issue 7, and removed in Issue 8. #[deprecated] +#[allow(deprecated)] #[unsafe(no_mangle)] pub unsafe extern "C" fn setitimer( which: c_int, diff --git a/src/header/sys_timeb/mod.rs b/src/header/sys_timeb/mod.rs index b2294238e5..8935f5b474 100644 --- a/src/header/sys_timeb/mod.rs +++ b/src/header/sys_timeb/mod.rs @@ -9,11 +9,10 @@ use core::ptr::NonNull; +#[allow(deprecated)] +use crate::header::sys_time::gettimeofday; use crate::{ - header::{ - sys_select::timeval, - sys_time::{gettimeofday, timezone}, - }, + header::{sys_select::timeval, sys_time::timezone}, platform::types::{c_int, c_short, c_ushort, time_t}, }; @@ -34,6 +33,7 @@ pub struct timeb { /// The caller must ensure that `tp` is convertible to a `&mut /// MaybeUninit`. #[deprecated] +#[allow(deprecated)] #[unsafe(no_mangle)] pub unsafe extern "C" fn ftime(tp: *mut timeb) -> c_int { // SAFETY: the caller is required to ensure that the pointer is valid. @@ -44,10 +44,15 @@ pub unsafe extern "C" fn ftime(tp: *mut timeb) -> c_int { // SAFETY: tv and tz are created above, and thus will coerce to valid // pointers. - if unsafe { gettimeofday(&raw mut tv, &raw mut tz) } < 0 { + if unsafe { + #[allow(deprecated)] + gettimeofday(&raw mut tv, &raw mut tz) + } < 0 + { return -1; } + #[allow(deprecated)] tp_maybe_uninit.write(timeb { time: tv.tv_sec, millitm: (tv.tv_usec / 1000) as c_ushort, diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs index 2a7d4ca454..5260095f25 100644 --- a/src/header/time/mod.rs +++ b/src/header/time/mod.rs @@ -147,7 +147,10 @@ pub struct itimerspec { #[deprecated] #[unsafe(no_mangle)] pub unsafe extern "C" fn asctime(timeptr: *const tm) -> *mut c_char { - unsafe { asctime_r(timeptr, (&raw mut ASCTIME).cast()) } + unsafe { + #[allow(deprecated)] + asctime_r(timeptr, (&raw mut ASCTIME).cast()) + } } /// See . @@ -296,7 +299,10 @@ pub unsafe extern "C" fn clock_settime(clock_id: clockid_t, tp: *const timespec) #[deprecated] #[unsafe(no_mangle)] pub unsafe extern "C" fn ctime(clock: *const time_t) -> *mut c_char { - unsafe { asctime(localtime(clock)) } + unsafe { + #[allow(deprecated)] + asctime(localtime(clock)) + } } /// See . @@ -310,7 +316,10 @@ pub unsafe extern "C" fn ctime_r(clock: *const time_t, buf: *mut c_char) -> *mut // Using MaybeUninit seems to cause a panic during the build process let mut tm1 = blank_tm(); unsafe { localtime_r(clock, &raw mut tm1) }; - unsafe { asctime_r(&raw const tm1, buf) } + unsafe { + #[allow(deprecated)] + asctime_r(&raw const tm1, buf) + } } /// See . diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs index 6c00d74964..21df741655 100644 --- a/src/header/unistd/mod.rs +++ b/src/header/unistd/mod.rs @@ -9,6 +9,8 @@ use core::{ ptr, slice, }; +#[allow(deprecated)] +use crate::platform::types::useconds_t; use crate::{ c_str::CStr, error::{Errno, ResultExt}, @@ -27,12 +29,12 @@ use crate::{ self, ERRNO, Pal, PalSignal, Sys, types::{ c_char, c_int, c_long, c_short, c_uint, c_ulonglong, c_void, gid_t, off_t, pid_t, - size_t, ssize_t, suseconds_t, time_t, uid_t, useconds_t, + size_t, ssize_t, suseconds_t, time_t, uid_t, }, }, }; -pub use self::{brk::*, getopt::*, getpass::getpass, pathconf::*, sysconf::*}; +pub use self::{brk::*, getopt::*, pathconf::*, sysconf::*}; pub use crate::header::pthread::fork_hooks; // Inclusion of ctermid() prototype marked as obsolescent since Issue 7, cf. @@ -1118,6 +1120,7 @@ pub extern "C" fn ttyname_r(fildes: c_int, name: *mut c_char, namesize: size_t) /// The `ualarm()` function was marked obsolescent in the Open Group Base /// Specifications Issue 6, and removed in Issue 7. #[deprecated] +#[allow(deprecated)] #[unsafe(no_mangle)] pub extern "C" fn ualarm(usecs: useconds_t, interval: useconds_t) -> useconds_t { // TODO setitimer is unimplemented on Redox and obsolete @@ -1167,6 +1170,7 @@ pub unsafe extern "C" fn unlinkat(fd: c_int, path: *const c_char, flags: c_int) /// The `usleep()` function was marked obsolescent in the Open Group Base /// Specifications Issue 6, and removed in Issue 7. #[deprecated] +#[allow(deprecated)] #[unsafe(no_mangle)] pub extern "C" fn usleep(useconds: useconds_t) -> c_int { #[cfg(not(target_arch = "x86"))] diff --git a/src/header/utime/mod.rs b/src/header/utime/mod.rs index 75f5238560..88e10e1062 100644 --- a/src/header/utime/mod.rs +++ b/src/header/utime/mod.rs @@ -26,6 +26,7 @@ pub struct utimbuf { /// See . #[deprecated] +#[allow(deprecated)] #[unsafe(no_mangle)] pub unsafe extern "C" fn utime(filename: *const c_char, times: *const utimbuf) -> c_int { let filename_cstr = unsafe { CStr::from_ptr(filename) }; diff --git a/src/io/error.rs b/src/io/error.rs index f72eb42c24..203f628a88 100644 --- a/src/io/error.rs +++ b/src/io/error.rs @@ -219,7 +219,6 @@ struct Custom { /// /// [`io::Error`]: struct.Error.html #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -#[allow(deprecated)] #[non_exhaustive] pub enum ErrorKind { /// An entity was not found, often a file. diff --git a/src/platform/linux/signal.rs b/src/platform/linux/signal.rs index 8c571ffd67..d2b21fe1a2 100644 --- a/src/platform/linux/signal.rs +++ b/src/platform/linux/signal.rs @@ -10,18 +10,21 @@ use super::{ }, Sys, e_raw, }; +#[allow(deprecated)] +use crate::header::sys_time::itimerval; use crate::{ error::{Errno, Result}, header::{ bits_timespec::timespec, signal::{SA_RESTORER, SI_QUEUE, sigaction, siginfo_t, sigset_t, sigval, stack_t}, sys_select::timeval, - sys_time::{self, itimerval}, + sys_time, }, platform, }; impl PalSignal for Sys { + #[allow(deprecated)] fn getitimer(which: c_int, out: &mut itimerval) -> Result<()> { unsafe { e_raw(syscall!(GETITIMER, which, ptr::from_mut(out)))?; @@ -58,6 +61,7 @@ impl PalSignal for Sys { Ok(()) } + #[allow(deprecated)] fn setitimer(which: c_int, new: &itimerval, old: Option<&mut itimerval>) -> Result<()> { e_raw(unsafe { syscall!( diff --git a/src/platform/pal/signal.rs b/src/platform/pal/signal.rs index 8a8aaac346..94b3a3ae58 100644 --- a/src/platform/pal/signal.rs +++ b/src/platform/pal/signal.rs @@ -2,18 +2,20 @@ use super::super::{ Pal, types::{c_int, c_uint, pid_t}, }; +#[allow(deprecated)] +use crate::header::sys_time::itimerval; use crate::{ error::{Errno, Result}, header::{ bits_timespec::timespec, signal::{sigaction, siginfo_t, sigset_t, sigval, stack_t}, - sys_time::itimerval, }, }; /// Platform abstraction of signal-related functionality. pub trait PalSignal: Pal { /// Platform implementation of [`getitimer()`](crate::header::sys_time::getitimer) from [`sys/time.h`](crate::header::sys_time). + #[allow(deprecated)] fn getitimer(which: c_int, out: &mut itimerval) -> Result<()>; /// Platform implementation of [`kill()`](crate::header::signal::kill) from [`signal.h`](crate::header::signal). @@ -29,6 +31,7 @@ pub trait PalSignal: Pal { fn raise(sig: c_int) -> Result<()>; /// Platform implementation of [`setitimer()`](crate::header::sys_time::setitimer) from [`sys/time.h`](crate::header::sys_time). + #[allow(deprecated)] fn setitimer(which: c_int, new: &itimerval, old: Option<&mut itimerval>) -> Result<()>; /// Platform implementation of [`alarm()`](crate::header::unistd::alarm) from [`unistd.h`](crate::header::unistd). diff --git a/src/platform/redox/signal.rs b/src/platform/redox/signal.rs index e4b17865c1..7987528708 100644 --- a/src/platform/redox/signal.rs +++ b/src/platform/redox/signal.rs @@ -2,6 +2,8 @@ use super::{ super::{Pal, PalSignal, types::*}, Sys, }; +#[allow(deprecated)] +use crate::header::sys_time::{ITIMER_REAL, itimerval}; use crate::{ error::{Errno, Result}, header::{ @@ -12,7 +14,6 @@ use crate::{ SS_DISABLE, SS_ONSTACK, sigaction, sigevent, siginfo_t, sigset_t, sigval, stack_t, ucontext_t, }, - sys_time::{ITIMER_REAL, itimerval}, time::{itimerspec, timer_internal_t}, }, out::Out, @@ -58,6 +59,7 @@ const _: () = { }; impl PalSignal for Sys { + #[allow(deprecated)] fn getitimer(which: c_int, out: &mut itimerval) -> Result<()> { let path = match which { ITIMER_REAL => "/scheme/itimer/1", @@ -100,6 +102,7 @@ impl PalSignal for Sys { unsafe { Self::rlct_kill(Self::current_os_tid(), sig as _) } } + #[allow(deprecated)] fn setitimer(which: c_int, _new: &itimerval, old: Option<&mut itimerval>) -> Result<()> { // TODO: setitimer is no longer part of POSIX and should not be implemented in Redox // Change the platform-independent implementation to use POSIX timers.