add #[allow(deprecated)] annotations

allow using deprecated functions and data structures
in deprecated functions
This commit is contained in:
sourceturner
2026-04-19 21:51:46 +02:00
committed by sourceturner
parent 885118ccac
commit 4ffd337b9b
12 changed files with 67 additions and 19 deletions
+5 -1
View File
@@ -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!(
+4 -1
View File
@@ -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).
+4 -1
View File
@@ -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.