Add lstat, fix timespec for musln32.

master
Yuhao Zhou 6 years ago
parent 189c4aa5c6
commit 3e7dd81dec

@ -3,6 +3,7 @@
use core::cell::UnsafeCell; use core::cell::UnsafeCell;
use core::cmp::min; use core::cmp::min;
use core::mem::size_of; use core::mem::size_of;
#[cfg(not(target_arch = "mips"))]
use rcore_fs::vfs::Timespec; use rcore_fs::vfs::Timespec;
use crate::drivers::SOCKET_ACTIVITY; use crate::drivers::SOCKET_ACTIVITY;
@ -913,6 +914,13 @@ pub struct Stat {
ctime: Timespec, ctime: Timespec,
} }
#[cfg(target_arch = "mips")]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub struct Timespec {
pub sec: i32,
pub nsec: i32,
}
#[cfg(target_arch = "mips")] #[cfg(target_arch = "mips")]
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
@ -1096,9 +1104,9 @@ impl From<Metadata> for Stat {
size: info.size as u64, size: info.size as u64,
blksize: info.blk_size as u32, blksize: info.blk_size as u32,
blocks: info.blocks as u64, blocks: info.blocks as u64,
atime: info.atime, atime: Timespec { sec: info.atime.sec as i32, nsec: info.atime.nsec },
mtime: info.mtime, mtime: Timespec { sec: info.mtime.sec as i32, nsec: info.mtime.nsec },
ctime: info.ctime, ctime: Timespec { sec: info.ctime.sec as i32, nsec: info.ctime.nsec },
__pad1: 0, __pad1: 0,
__pad2: 0, __pad2: 0,
__pad3: 0, __pad3: 0,

@ -324,6 +324,7 @@ fn mips_syscall(id: usize, args: [usize; 6], tf: &mut TrapFrame) -> Option<SysRe
SYS_DUP2 => sys_dup2(args[0], args[1]), SYS_DUP2 => sys_dup2(args[0], args[1]),
SYS_MMAP2 => sys_mmap(args[0], args[1], args[2], args[3], args[4], args[5] * 4096), SYS_MMAP2 => sys_mmap(args[0], args[1], args[2], args[3], args[4], args[5] * 4096),
SYS_FSTAT64 => sys_fstat(args[0], args[1] as *mut Stat), SYS_FSTAT64 => sys_fstat(args[0], args[1] as *mut Stat),
SYS_LSTAT64 => sys_lstat(args[0] as *const u8, args[1] as *mut Stat),
SYS_STAT64 => sys_stat(args[0] as *const u8, args[1] as *mut Stat), SYS_STAT64 => sys_stat(args[0] as *const u8, args[1] as *mut Stat),
SYS_PIPE => { SYS_PIPE => {
let fd_ptr = args[0] as *mut u32; let fd_ptr = args[0] as *mut u32;

Loading…
Cancel
Save