Couple of misc improvements

Fix a bunch of warnings and clarify that execve will never return Ok by
using Infallible
This commit is contained in:
bjorn3
2025-03-30 20:18:01 +02:00
parent 121e733990
commit facc643e18
8 changed files with 16 additions and 25 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ impl<Os> GenericTcb<Os> {
Some(&mut *Self::current_ptr()?)
}
}
pub fn panic_notls(msg: impl core::fmt::Display) -> ! {
pub fn panic_notls(_msg: impl core::fmt::Display) -> ! {
//eprintln!("panicked in ld.so: {}", msg);
core::intrinsics::abort();
+2 -5
View File
@@ -12,11 +12,8 @@ use syscall::{
use crate::{
proc::{fork_inner, FdGuard},
signal::{
get_sigaltstack, inner_c, PosixStackt, RtSigarea, SigStack, Sigaltstack,
PROC_CONTROL_STRUCT,
},
RtTcb, Tcb,
signal::{get_sigaltstack, inner_c, PosixStackt, RtSigarea, SigStack, PROC_CONTROL_STRUCT},
Tcb,
};
// Setup a stack starting from the very end of the address space, and then growing downwards.
-1
View File
@@ -1,6 +1,5 @@
#![no_std]
#![feature(
asm_const,
array_chunks,
int_roundings,
let_chains,
+4 -12
View File
@@ -1,17 +1,9 @@
use core::{
cell::{Cell, UnsafeCell},
ffi::{c_int, c_void},
mem::MaybeUninit,
ptr::NonNull,
sync::atomic::{AtomicU8, AtomicUsize, Ordering},
};
use core::{ffi::c_int, mem::MaybeUninit, ptr::NonNull, sync::atomic::Ordering};
use syscall::{
data::AtomicU64, Error, NonatomicUsize, RawAction, Result, RtSigInfo, SenderInfo,
SetSighandlerData, SigProcControl, Sigcontrol, SigcontrolFlags, TimeSpec, EAGAIN, EINTR,
EINVAL, ENOMEM, EPERM, SIGABRT, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGILL, SIGKILL, SIGQUIT,
SIGSEGV, SIGSTOP, SIGSYS, SIGTRAP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGWINCH, SIGXCPU,
SIGXFSZ,
data::AtomicU64, Error, RawAction, Result, RtSigInfo, SenderInfo, SetSighandlerData,
SigProcControl, Sigcontrol, SigcontrolFlags, TimeSpec, EAGAIN, EINTR, EINVAL, ENOMEM, EPERM,
SIGCHLD, SIGKILL, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGWINCH,
};
use crate::{arch::*, proc::FdGuard, sync::Mutex, RtTcb, Tcb};
+1 -1
View File
@@ -73,7 +73,7 @@ _start:
#[linkage = "weak"]
#[no_mangle]
extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! {
extern "C" fn relibc_panic(_pi: &::core::panic::PanicInfo) -> ! {
loop {}
}
+1 -1
View File
@@ -76,7 +76,7 @@ global_asm!(
#[linkage = "weak"]
#[no_mangle]
extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! {
extern "C" fn relibc_panic(_pi: &::core::panic::PanicInfo) -> ! {
loop {}
}
+1 -1
View File
@@ -62,7 +62,7 @@ global_asm!(
#[linkage = "weak"]
#[no_mangle]
extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! {
extern "C" fn relibc_panic(_pi: &::core::panic::PanicInfo) -> ! {
loop {}
}
+6 -3
View File
@@ -1,4 +1,7 @@
use core::num::{NonZeroU64, NonZeroUsize};
use core::{
convert::Infallible,
num::{NonZeroU64, NonZeroUsize},
};
use crate::{
c_str::{CStr, CString},
@@ -23,7 +26,7 @@ fn fexec_impl(
total_args_envs_size: usize,
extrainfo: &ExtraInfo,
interp_override: Option<InterpOverride>,
) -> Result<usize> {
) -> Result<Infallible> {
let memory = FdGuard::new(syscall::open("/scheme/memory", 0)?);
let addrspace_selection_fd = match redox_rt::proc::fexec_impl(
@@ -91,7 +94,7 @@ pub fn execve(
exec: Executable<'_>,
arg_env: ArgEnv,
interp_override: Option<InterpOverride>,
) -> Result<usize> {
) -> Result<Infallible> {
// NOTE: We must omit O_CLOEXEC and close manually, otherwise it will be closed before we
// have even read it!
let (mut image_file, arg0) = match exec {