1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-25 09:26:17 +04:00

run cargo fmt

This commit is contained in:
function2-llx 2020-06-06 04:27:19 +08:00
parent 3d83f84556
commit c157890f33
11 changed files with 31 additions and 22 deletions

View File

@ -1,4 +1,5 @@
use crate::arch::get_sp; use crate::arch::get_sp;
use crate::arch::signal::MachineContext;
use crate::process::{current_thread, thread_manager}; use crate::process::{current_thread, thread_manager};
use crate::signal::*; use crate::signal::*;
use alloc::vec::Vec; use alloc::vec::Vec;
@ -6,7 +7,6 @@ use core::default::Default;
use core::fmt; use core::fmt;
use num::FromPrimitive; use num::FromPrimitive;
use rcore_thread::std_thread::current; use rcore_thread::std_thread::current;
use crate::arch::signal::MachineContext;
#[derive(Clone)] #[derive(Clone)]
#[repr(C)] #[repr(C)]

View File

@ -15,9 +15,9 @@ pub mod ipi;
pub mod memory; pub mod memory;
pub mod paging; pub mod paging;
pub mod rand; pub mod rand;
pub mod signal;
pub mod syscall; pub mod syscall;
pub mod timer; pub mod timer;
pub mod signal;
static AP_CAN_INIT: AtomicBool = AtomicBool::new(false); static AP_CAN_INIT: AtomicBool = AtomicBool::new(false);

View File

@ -1,6 +1,6 @@
use crate::signal::Signal; use crate::signal::Signal;
use bitflags::*;
use bitflags::_core::fmt::Debug; use bitflags::_core::fmt::Debug;
use bitflags::*;
use core::fmt::Formatter; use core::fmt::Formatter;
pub const SIG_ERR: usize = usize::max_value() - 1; pub const SIG_ERR: usize = usize::max_value() - 1;
@ -66,7 +66,6 @@ impl Debug for SignalAction {
} }
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub union SiginfoFields { pub union SiginfoFields {

View File

@ -8,13 +8,13 @@ mod action;
pub use self::action::*; pub use self::action::*;
use crate::arch::interrupt::TrapFrame; use crate::arch::interrupt::TrapFrame;
use crate::arch::signal::MachineContext;
use crate::arch::syscall::SYS_RT_SIGRETURN;
use crate::arch::{get_sp, set_sp}; use crate::arch::{get_sp, set_sp};
use crate::processor; use crate::processor;
use crate::syscall::{SysError, SysResult}; use crate::syscall::{SysError, SysResult};
use alloc::vec::Vec; use alloc::vec::Vec;
use rcore_thread::std_thread::{current, yield_now}; use rcore_thread::std_thread::{current, yield_now};
use crate::arch::syscall::SYS_RT_SIGRETURN;
use crate::arch::signal::MachineContext;
#[derive(Eq, PartialEq, FromPrimitive, Debug, Copy, Clone)] #[derive(Eq, PartialEq, FromPrimitive, Debug, Copy, Clone)]
pub enum Signal { pub enum Signal {
@ -254,7 +254,9 @@ pub fn do_signal(tf: &mut TrapFrame) {
// mov SYS_RT_SIGRETURN, %eax // mov SYS_RT_SIGRETURN, %eax
frame.ret_code[0] = 0xb8; frame.ret_code[0] = 0xb8;
// TODO: ref plz // TODO: ref plz
unsafe { *(frame.ret_code.as_ptr().add(1) as *mut u32) = SYS_RT_SIGRETURN as u32; } unsafe {
*(frame.ret_code.as_ptr().add(1) as *mut u32) = SYS_RT_SIGRETURN as u32;
}
// syscall // syscall
frame.ret_code[5] = 0x0f; frame.ret_code[5] = 0x0f;
frame.ret_code[6] = 0x05; frame.ret_code[6] = 0x05;

View File

@ -21,10 +21,10 @@ use crate::fs::epoll::EpollInstance;
use crate::fs::fcntl::{FD_CLOEXEC, F_SETFD, O_CLOEXEC, O_NONBLOCK}; use crate::fs::fcntl::{FD_CLOEXEC, F_SETFD, O_CLOEXEC, O_NONBLOCK};
use crate::fs::FileLike; use crate::fs::FileLike;
use crate::process::Process; use crate::process::Process;
use crate::syscall::SysError::{EINVAL, ESPIPE, EINTR}; use crate::signal::has_signal_to_do;
use crate::syscall::SysError::{EINTR, EINVAL, ESPIPE};
use rcore_fs::vfs::PollStatus; use rcore_fs::vfs::PollStatus;
use rcore_thread::std_thread::current; use rcore_thread::std_thread::current;
use crate::signal::has_signal_to_do;
impl Syscall<'_> { impl Syscall<'_> {
pub fn sys_read(&mut self, fd: usize, base: *mut u8, len: usize) -> SysResult { pub fn sys_read(&mut self, fd: usize, base: *mut u8, len: usize) -> SysResult {

View File

@ -39,7 +39,7 @@ mod proc;
mod signal; mod signal;
mod time; mod time;
use crate::signal::{Signal, SignalAction, SignalStack, Sigset, SignalFrame}; use crate::signal::{Signal, SignalAction, SignalFrame, SignalStack, Sigset};
#[cfg(feature = "profile")] #[cfg(feature = "profile")]
use alloc::collections::BTreeMap; use alloc::collections::BTreeMap;
use rcore_thread::std_thread::yield_now; use rcore_thread::std_thread::yield_now;
@ -223,7 +223,9 @@ impl Syscall<'_> {
args[2] as *mut Sigset, args[2] as *mut Sigset,
args[3], args[3],
), ),
SYS_SIGALTSTACK => self.sys_sigaltstack(args[0] as *const SignalStack, args[1] as *mut SignalStack), SYS_SIGALTSTACK => {
self.sys_sigaltstack(args[0] as *const SignalStack, args[1] as *mut SignalStack)
}
SYS_KILL => self.sys_kill(args[0] as isize, args[1]), SYS_KILL => self.sys_kill(args[0] as isize, args[1]),
// schedule // schedule

View File

@ -2,8 +2,8 @@
use super::*; use super::*;
use crate::fs::FileLike; use crate::fs::FileLike;
use crate::signal::{send_signal, Signal, has_signal_to_do}; use crate::signal::{has_signal_to_do, send_signal, Signal};
use crate::syscall::SysError::{ESRCH, EINTR}; use crate::syscall::SysError::{EINTR, ESRCH};
use alloc::sync::Weak; use alloc::sync::Weak;
impl Syscall<'_> { impl Syscall<'_> {

View File

@ -1,3 +1,4 @@
use crate::arch::interrupt::TrapFrame;
use crate::process::{current_thread, process_of, thread_manager, PROCESSES}; use crate::process::{current_thread, process_of, thread_manager, PROCESSES};
use crate::process::{process, process_group}; use crate::process::{process, process_group};
use crate::signal::Signal::SIGINT; use crate::signal::Signal::SIGINT;
@ -6,7 +7,6 @@ use crate::syscall::SysError::{EINVAL, ENOMEM, EPERM, ESRCH};
use crate::syscall::{SysResult, Syscall}; use crate::syscall::{SysResult, Syscall};
use crate::thread; use crate::thread;
use num::FromPrimitive; use num::FromPrimitive;
use crate::arch::interrupt::TrapFrame;
impl Syscall<'_> { impl Syscall<'_> {
pub fn sys_rt_sigaction( pub fn sys_rt_sigaction(
@ -22,7 +22,10 @@ impl Syscall<'_> {
signal, act, oldact, sigsetsize signal, act, oldact, sigsetsize
); );
use Signal::*; use Signal::*;
if signal == SIGKILL || signal == SIGSTOP || sigsetsize != core::mem::size_of::<Sigset>() { if signal == SIGKILL
|| signal == SIGSTOP
|| sigsetsize != core::mem::size_of::<Sigset>()
{
Err(EINVAL) Err(EINVAL)
} else { } else {
let mut proc = self.process(); let mut proc = self.process();
@ -53,7 +56,8 @@ impl Syscall<'_> {
// frame.info.signo // frame.info.signo
{ {
let mut process = self.process(); let mut process = self.process();
process.sigaltstack.flags ^= process.sigaltstack.flags & SignalStackFlags::ONSTACK.bits(); process.sigaltstack.flags ^=
process.sigaltstack.flags & SignalStackFlags::ONSTACK.bits();
} }
// *self.tf = TrapFrame::from_mcontext(&frame.ucontext.mcontext); // *self.tf = TrapFrame::from_mcontext(&frame.ucontext.mcontext);

View File

@ -10,7 +10,9 @@ pub static mut TICK: usize = 0;
global_asm!(include_str!("fpe.S")); global_asm!(include_str!("fpe.S"));
extern "C" { fn fpe(); } extern "C" {
fn fpe();
}
lazy_static! { lazy_static! {
pub static ref TICK_ACTIVITY: Condvar = Condvar::new(); pub static ref TICK_ACTIVITY: Condvar = Condvar::new();

2
user

@ -1 +1 @@
Subproject commit 12a9fb7d2509813465c9ffb0220c53f2566b2910 Subproject commit 8223437f9ba848fde7ea1794bc4e51a44523352c