From 2c423e9a446e8deb1c4844f6c658058191c6ee94 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 4 Oct 2025 08:15:24 -0600 Subject: [PATCH] Update bootstrap to edition 2024 --- bootstrap/Cargo.toml | 2 +- bootstrap/src/exec.rs | 2 +- bootstrap/src/initfs.rs | 8 ++++---- bootstrap/src/procmgr.rs | 4 ++-- bootstrap/src/start.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bootstrap/Cargo.toml b/bootstrap/Cargo.toml index 5957b8b7cb..4e47886def 100644 --- a/bootstrap/Cargo.toml +++ b/bootstrap/Cargo.toml @@ -2,7 +2,7 @@ name = "bootstrap" version = "0.0.0" authors = ["4lDO2 <4lDO2@protonmail.com>"] -edition = "2021" +edition = "2024" license = "MIT" [lib] diff --git a/bootstrap/src/exec.rs b/bootstrap/src/exec.rs index 589c467e72..ef56e7cee2 100644 --- a/bootstrap/src/exec.rs +++ b/bootstrap/src/exec.rs @@ -58,7 +58,7 @@ pub fn main() -> ! { iter().map(|var| var.to_owned()).collect::>() }; - extern "C" { + unsafe extern "C" { // The linker script will define this as the location of the initfs header. static __initfs_header: u8; } diff --git a/bootstrap/src/initfs.rs b/bootstrap/src/initfs.rs index a594140c9c..5f88f05a04 100644 --- a/bootstrap/src/initfs.rs +++ b/bootstrap/src/initfs.rs @@ -344,22 +344,22 @@ pub fn run(bytes: &'static [u8], sync_pipe: usize) -> ! { // TODO: Restructure bootstrap so it calls into relibc, or a split-off derivative without the C // parts, such as "redox-rt". -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn redox_read_v1(fd: usize, ptr: *mut u8, len: usize) -> isize { Error::mux(syscall::read(fd, core::slice::from_raw_parts_mut(ptr, len))) as isize } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn redox_write_v1(fd: usize, ptr: *const u8, len: usize) -> isize { Error::mux(syscall::write(fd, core::slice::from_raw_parts(ptr, len))) as isize } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn redox_open_v1(ptr: *const u8, len: usize, flags: usize) -> isize { Error::mux(syscall::open(core::str::from_raw_parts(ptr, len), flags)) as isize } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn redox_close_v1(fd: usize) -> isize { Error::mux(syscall::close(fd)) as isize } diff --git a/bootstrap/src/procmgr.rs b/bootstrap/src/procmgr.rs index 35969bc109..48645279c2 100644 --- a/bootstrap/src/procmgr.rs +++ b/bootstrap/src/procmgr.rs @@ -228,14 +228,14 @@ fn handle_scheme<'a>( awoken, ), Op::Fsize { req, fd } => { - if let Handle::Ps(ref b) = &scheme.handles[fd] { + if let Handle::Ps(b) = &scheme.handles[fd] { Response::ready_ok(b.len(), req) } else { Response::ready_err(EOPNOTSUPP, req) } } Op::Fstat(mut op) => { - if let Handle::Ps(ref b) = &scheme.handles[op.fd] { + if let Handle::Ps(b) = &scheme.handles[op.fd] { op.buf().st_size = b.len() as _; op.buf().st_mode = syscall::MODE_FILE | 0o444; Response::ready_ok(0, op) diff --git a/bootstrap/src/start.rs b/bootstrap/src/start.rs index f85ec084ab..1be39fc286 100644 --- a/bootstrap/src/start.rs +++ b/bootstrap/src/start.rs @@ -1,7 +1,7 @@ use syscall::flag::MapFlags; mod offsets { - extern "C" { + unsafe extern "C" { // text (R-X) static __text_start: u8; static __text_end: u8; @@ -38,7 +38,7 @@ mod offsets { } } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn start() -> ! { // Remap self, from the previous RWX