misc(lint): unused variables and imports

Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
Anhad Singh
2024-12-17 21:34:46 +11:00
parent 500848bc76
commit eb82f9afeb
4 changed files with 8 additions and 16 deletions
+2 -2
View File
@@ -4,8 +4,8 @@ use super::{
tcb::Master,
};
use crate::{
header::{errno::STR_ERROR, sys_mman},
platform::{types::c_void, Pal, Sys, ERRNO},
header::sys_mman,
platform::{types::c_void, Pal, Sys},
};
use alloc::{
collections::BTreeMap,
+1 -1
View File
@@ -31,7 +31,7 @@ use super::{
debug::{RTLDState, _dl_debug_state, _r_debug},
dso::{is_pie_enabled, DSO},
tcb::{Master, Tcb},
ExpectTlsFree, PATH_SEP,
PATH_SEP,
};
/// Same as [`crate::fs::File`], but does not touch [`crate::platform::ERRNO`] as the dynamic
+1 -7
View File
@@ -12,7 +12,6 @@ use generic_rt::ExpectTlsFree;
use crate::{
c_str::CStr,
header::unistd,
ld_so::tcb::Master,
platform::{get_auxv, get_auxvs, types::c_char},
start::Stack,
sync::mutex::Mutex,
@@ -207,12 +206,7 @@ pub extern "C" fn relibc_ld_so_start(
}
// TODO: Fix memory leak, although minimal.
unsafe {
crate::platform::init(auxv.clone());
}
// Some variables that will be overridden by environment and auxiliary vectors
let ld_library_path = envs.get("LD_LIBRARY_PATH").map(|s| s.to_owned());
crate::platform::init(auxv.clone());
let name_or_path = if is_manual {
// ld.so is run directly by user and not via execve() or similar systemcall
+4 -6
View File
@@ -1,6 +1,5 @@
use alloc::vec::Vec;
use core::{
arch::asm,
cell::UnsafeCell,
mem,
ops::{Deref, DerefMut},
@@ -10,7 +9,6 @@ use core::{
use generic_rt::GenericTcb;
use goblin::error::{Error, Result};
use super::ExpectTlsFree;
use crate::{
header::sys_mman,
ld_so::linker::Linker,
@@ -80,7 +78,7 @@ impl Tcb {
/// `size` is the size of the TLS in bytes.
pub unsafe fn new(size: usize) -> Result<&'static mut Self> {
let page_size = Sys::getpagesize();
let (abi_page, tls, tcb_page) = Self::os_new(size.next_multiple_of(page_size))?;
let (_abi_page, tls, tcb_page) = Self::os_new(size.next_multiple_of(page_size))?;
let tcb_ptr = tcb_page.as_mut_ptr() as *mut Self;
trace!("New TCB: {:p}", tcb_ptr);
@@ -212,8 +210,8 @@ impl Tcb {
pub fn setup_dtv(&mut self, n: usize) {
if self.dtv_ptr.is_null() {
let mut dtv = vec![ptr::null_mut(); n];
let (ptr, len, cap) = dtv.into_raw_parts();
let dtv = vec![ptr::null_mut(); n];
let (ptr, len, _) = dtv.into_raw_parts();
self.dtv_ptr = ptr;
self.dtv_len = len;
@@ -269,7 +267,7 @@ impl Tcb {
/// OS and architecture specific code to activate TLS - Linux x86_64
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
unsafe fn os_arch_activate(os: &(), tls_end: usize, _tls_len: usize) {
unsafe fn os_arch_activate(_os: &(), tls_end: usize, _tls_len: usize) {
const ARCH_SET_FS: usize = 0x1002;
syscall!(ARCH_PRCTL, ARCH_SET_FS, tls_end);
}