Merge branch 'pthread-platform-cleanup' into 'master'

platform and pthread cleanup

See merge request redox-os/relibc!1051
This commit is contained in:
Jeremy Soller
2026-02-27 14:50:06 -07:00
4 changed files with 18 additions and 18 deletions
+4 -4
View File
@@ -160,7 +160,7 @@ impl Pal for Sys {
envp: *const *mut c_char,
) -> Result<()> {
let empty = b"\0";
let empty_ptr = empty.as_ptr() as *const c_char;
let empty_ptr = empty.as_ptr().cast::<c_char>();
e_raw(syscall!(
EXECVEAT,
fildes,
@@ -218,7 +218,7 @@ impl Pal for Sys {
fn fstat(fildes: c_int, mut buf: Out<stat>) -> Result<()> {
let empty = b"\0";
let empty_ptr = empty.as_ptr() as *const c_char;
let empty_ptr = empty.as_ptr().cast::<c_char>();
e_raw(unsafe {
syscall!(
NEWFSTATAT,
@@ -248,7 +248,7 @@ impl Pal for Sys {
let buf = buf.as_mut_ptr();
let mut kbuf = linux_statfs::default();
let kbuf_ptr = &mut kbuf as *mut linux_statfs;
let kbuf_ptr = &raw mut kbuf;
e_raw(unsafe { syscall!(FSTATFS, fildes, kbuf_ptr) })?;
if !buf.is_null() {
@@ -296,7 +296,7 @@ impl Pal for Sys {
#[inline]
unsafe fn futex_wait(addr: *mut u32, val: u32, deadline: Option<&timespec>) -> Result<()> {
let deadline = deadline.map_or(0, |d| d as *const _ as usize);
let deadline = deadline.map_or(0, |d| ptr::from_ref(d) as usize);
e_raw(unsafe {
syscall!(
FUTEX, addr, // uaddr
+9 -9
View File
@@ -62,7 +62,7 @@ impl PalSignal for Sys {
SETITIMER,
which,
ptr::from_ref(new),
old.map_or_else(ptr::null_mut, |r| ptr::from_mut(r))
old.map_or_else(ptr::null_mut, ptr::from_mut)
)
})?;
Ok(())
@@ -86,8 +86,8 @@ impl PalSignal for Sys {
syscall!(
RT_SIGACTION,
sig,
act.as_ref().map_or_else(ptr::null, |x| ptr::from_ref(x)),
oact.map_or_else(ptr::null_mut, |x| ptr::from_mut(x)),
act.as_ref().map_or_else(ptr::null, ptr::from_ref),
oact.map_or_else(ptr::null_mut, ptr::from_mut),
mem::size_of::<sigset_t>()
)
})
@@ -97,8 +97,8 @@ impl PalSignal for Sys {
unsafe fn sigaltstack(ss: Option<&stack_t>, old_ss: Option<&mut stack_t>) -> Result<()> {
e_raw(syscall!(
SIGALTSTACK,
ss.map_or_else(ptr::null, |x| ptr::from_ref(x)),
old_ss.map_or_else(ptr::null_mut, |x| ptr::from_mut(x))
ss.map_or_else(ptr::null, ptr::from_ref),
old_ss.map_or_else(ptr::null_mut, ptr::from_mut)
))
.map(|_| ())
}
@@ -119,8 +119,8 @@ impl PalSignal for Sys {
syscall!(
RT_SIGPROCMASK,
how,
set.map_or_else(ptr::null, |x| ptr::from_ref(x)),
oset.map_or_else(ptr::null_mut, |x| ptr::from_mut(x)),
set.map_or_else(ptr::null, ptr::from_ref),
oset.map_or_else(ptr::null_mut, ptr::from_mut),
mem::size_of::<sigset_t>()
)
})
@@ -147,8 +147,8 @@ impl PalSignal for Sys {
e_raw(syscall!(
RT_SIGTIMEDWAIT,
ptr::from_ref(set),
sig.map_or_else(ptr::null_mut, |s| ptr::from_mut(s)),
tp.map_or_else(ptr::null, |t| ptr::from_ref(t)),
sig.map_or_else(ptr::null_mut, ptr::from_mut),
tp.map_or_else(ptr::null, ptr::from_ref),
size_of::<sigset_t>()
))
.map(|s| s as c_int)
+1 -1
View File
@@ -263,7 +263,7 @@ impl<T: Write> Write for CountingWriter<T> {
res
}
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
match self.inner.write_all(&buf) {
match self.inner.write_all(buf) {
Ok(()) => (),
Err(ref err) if err.kind() == io::ErrorKind::WriteZero => (),
Err(err) => return Err(err),
+4 -4
View File
@@ -168,7 +168,7 @@ pub(crate) unsafe fn create(
new_tcb.mspace = current_tcb.mspace;
let stack_end = unsafe { stack_base.add(stack_size) };
let mut stack = stack_end as *mut usize;
let mut stack = stack_end.cast::<usize>();
{
let mut push = |value: usize| {
stack = unsafe { stack.sub(1) };
@@ -184,8 +184,8 @@ pub(crate) unsafe fn create(
}
push(0);
push(0);
push(synchronization_mutex as *const _ as usize);
push(new_tcb as *mut _ as usize);
push(ptr::from_ref(synchronization_mutex) as usize);
push(ptr::from_mut(new_tcb) as usize);
push(arg as usize);
push(start_routine as usize);
@@ -204,7 +204,7 @@ pub(crate) unsafe fn create(
.lock()
.insert(os_tid, ForceSendSync(new_tcb));
Ok((&new_tcb.pthread) as *const _ as *mut _)
Ok(&raw const new_tcb.pthread as *mut _)
}
/// A shim to wrap thread entry points in logic to set up TLS, for example