Merge branch 'usercopy' into 'master'

Remove physunmap and impl Deref for SigAction

See merge request redox-os/syscall!74
This commit is contained in:
Jeremy Soller
2023-06-11 14:16:22 +00:00
3 changed files with 18 additions and 11 deletions
-10
View File
@@ -264,16 +264,6 @@ pub unsafe fn physmap(physical_address: usize, size: usize, flags: PhysmapFlags)
syscall3(SYS_PHYSMAP, physical_address, size, flags.bits())
}
/// Unmap previously mapped physical memory
///
/// # Errors
///
/// * `EPERM` - `uid != 0`
/// * `EFAULT` - `virtual_address` has not been mapped
pub unsafe fn physunmap(virtual_address: usize) -> Result<usize> {
syscall1(SYS_PHYSUNMAP, virtual_address)
}
/// Create a pair of file descriptors referencing the read and write ends of a pipe
pub fn pipe2(fds: &mut [usize; 2], flags: usize) -> Result<usize> {
unsafe { syscall2(SYS_PIPE2, fds.as_ptr() as usize, flags) }
+18
View File
@@ -149,6 +149,24 @@ pub struct SigAction {
pub sa_mask: [u64; 2],
pub sa_flags: SigActionFlags,
}
impl Deref for SigAction {
type Target = [u8];
fn deref(&self) -> &[u8] {
unsafe {
slice::from_raw_parts(self as *const SigAction as *const u8,
mem::size_of::<SigAction>())
}
}
}
impl DerefMut for SigAction {
fn deref_mut(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(self as *mut SigAction as *mut u8,
mem::size_of::<SigAction>())
}
}
}
#[allow(dead_code)]
unsafe fn _assert_size_of_function_is_sane() {
-1
View File
@@ -58,7 +58,6 @@ pub const SYS_PHYSALLOC: usize =945;
pub const SYS_PHYSALLOC3: usize=9453;
pub const SYS_PHYSFREE: usize = 946;
pub const SYS_PHYSMAP: usize = 947;
pub const SYS_PHYSUNMAP: usize =948;
pub const SYS_VIRTTOPHYS: usize=949;
pub const SYS_PIPE2: usize = 331;
pub const SYS_SETPGID: usize = 57;