Refactor POSIX to UNIX

This renames the directory containing posix to unix; where applicable,
it also rename functions with the word "posix" to "unix"
This commit is contained in:
infrandomness 2022-06-05 22:29:30 +02:00
parent 2eae474673
commit d0a0369a24
17 changed files with 22 additions and 22 deletions

View File

@ -28,7 +28,7 @@
use rustc_target::abi::Size;
use rustc_target::spec::abi::Abi;
use crate::{shims::posix::FileHandler, *};
use crate::{shims::unix::FileHandler, *};
// Some global facts about the emulated machine.
pub const PAGE_SIZE: u64 = 4 * 1024; // FIXME: adjust to target architecture
@ -266,9 +266,9 @@ pub struct Evaluator<'mir, 'tcx> {
pub(crate) enforce_abi: bool,
/// The table of file descriptors.
pub(crate) file_handler: shims::posix::FileHandler,
pub(crate) file_handler: shims::unix::FileHandler,
/// The table of directory descriptors.
pub(crate) dir_handler: shims::posix::DirHandler,
pub(crate) dir_handler: shims::unix::DirHandler,
/// The "time anchor" for this machine's monotone clock (for `Instant` simulation).
pub(crate) time_anchor: Instant,

View File

@ -2,13 +2,13 @@
use rustc_target::spec::abi::Abi;
use crate::*;
use shims::posix::dlsym as posix;
use shims::unix::dlsym as unix;
use shims::windows::dlsym as windows;
#[derive(Debug, Copy, Clone)]
#[allow(non_camel_case_types)]
pub enum Dlsym {
Posix(posix::Dlsym),
Posix(unix::Dlsym),
Windows(windows::Dlsym),
}
@ -18,7 +18,7 @@ impl Dlsym {
pub fn from_str<'tcx>(name: &[u8], target_os: &str) -> InterpResult<'tcx, Option<Dlsym>> {
let name = &*String::from_utf8_lossy(name);
Ok(match target_os {
"linux" | "macos" => posix::Dlsym::from_str(name, target_os)?.map(Dlsym::Posix),
"linux" | "macos" => unix::Dlsym::from_str(name, target_os)?.map(Dlsym::Posix),
"windows" => windows::Dlsym::from_str(name)?.map(Dlsym::Windows),
os => bug!("dlsym not implemented for target_os {}", os),
})
@ -38,7 +38,7 @@ fn call_dlsym(
let this = self.eval_context_mut();
match dlsym {
Dlsym::Posix(dlsym) =>
posix::EvalContextExt::call_dlsym(this, dlsym, abi, args, dest, ret),
unix::EvalContextExt::call_dlsym(this, dlsym, abi, args, dest, ret),
Dlsym::Windows(dlsym) =>
windows::EvalContextExt::call_dlsym(this, dlsym, abi, args, dest, ret),
}

View File

@ -702,7 +702,7 @@ fn emulate_foreign_item_by_name(
// Platform-specific shims
_ => match this.tcx.sess.target.os.as_ref() {
"linux" | "macos" => return shims::posix::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
"linux" | "macos" => return shims::unix::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
"windows" => return shims::windows::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
target => throw_unsup_format!("the target `{}` is not supported", target),
}

View File

@ -1,7 +1,7 @@
mod backtrace;
pub mod foreign_items;
pub mod intrinsics;
pub mod posix;
pub mod unix;
pub mod windows;
pub mod dlsym;

View File

@ -2,8 +2,8 @@
use rustc_target::spec::abi::Abi;
use crate::*;
use shims::posix::linux::dlsym as linux;
use shims::posix::macos::dlsym as macos;
use shims::unix::linux::dlsym as linux;
use shims::unix::macos::dlsym as macos;
#[derive(Debug, Copy, Clone)]
pub enum Dlsym {

View File

@ -10,9 +10,9 @@
use crate::*;
use shims::foreign_items::EmulateByNameResult;
use shims::posix::fs::EvalContextExt as _;
use shims::posix::sync::EvalContextExt as _;
use shims::posix::thread::EvalContextExt as _;
use shims::unix::fs::EvalContextExt as _;
use shims::unix::sync::EvalContextExt as _;
use shims::unix::thread::EvalContextExt as _;
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
@ -477,8 +477,8 @@ fn emulate_foreign_item_by_name(
// Platform-specific shims
_ => {
match this.tcx.sess.target.os.as_ref() {
"linux" => return shims::posix::linux::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
"macos" => return shims::posix::macos::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
"linux" => return shims::unix::linux::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
"macos" => return shims::unix::macos::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, abi, args, dest, ret),
_ => unreachable!(),
}
}

View File

@ -4,10 +4,10 @@
use crate::*;
use shims::foreign_items::EmulateByNameResult;
use shims::posix::fs::EvalContextExt as _;
use shims::posix::linux::sync::futex;
use shims::posix::sync::EvalContextExt as _;
use shims::posix::thread::EvalContextExt as _;
use shims::unix::fs::EvalContextExt as _;
use shims::unix::linux::sync::futex;
use shims::unix::sync::EvalContextExt as _;
use shims::unix::thread::EvalContextExt as _;
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {

View File

@ -4,8 +4,8 @@
use crate::*;
use shims::foreign_items::EmulateByNameResult;
use shims::posix::fs::EvalContextExt as _;
use shims::posix::thread::EvalContextExt as _;
use shims::unix::fs::EvalContextExt as _;
use shims::unix::thread::EvalContextExt as _;
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {