Remove SYS_OPEN, SYS_UNLINK, and SYS_RMDIR. Add namespace related features
This commit is contained in:
committed by
Jeremy Soller
parent
2d11366fd1
commit
208cf4b6ff
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "redox_syscall"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
description = "A Rust library to access raw Redox system calls"
|
||||
license = "MIT"
|
||||
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
|
||||
|
||||
@@ -174,12 +174,6 @@ pub fn nanosleep(req: &TimeSpec, rem: &mut TimeSpec) -> Result<usize> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Open a file
|
||||
pub fn open<T: AsRef<str>>(path: T, flags: usize) -> Result<usize> {
|
||||
let path = path.as_ref();
|
||||
unsafe { syscall3(SYS_OPEN, path.as_ptr() as usize, path.len(), flags) }
|
||||
}
|
||||
|
||||
/// Open a file at a specific path
|
||||
pub fn openat<T: AsRef<str>>(
|
||||
fd: usize,
|
||||
|
||||
@@ -408,6 +408,15 @@ impl DerefMut for CtxtStsBuf {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(C)]
|
||||
pub struct NewFdParams {
|
||||
pub offset: u64,
|
||||
pub number: usize,
|
||||
pub flags: usize,
|
||||
pub internal_flags: u8,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum GlobalSchemes {
|
||||
|
||||
@@ -102,6 +102,9 @@ bitflags::bitflags! {
|
||||
/// If set, the file descriptors received will be placed into the *upper* file table.
|
||||
const UPPER_TBL = 4;
|
||||
|
||||
/// If set, the received file descriptors are marked as close-on-exec.
|
||||
const CLOEXEC = 8;
|
||||
|
||||
// No, cloexec won't be stored in the kernel in the future, when the stable ABI is moved to
|
||||
// relibc, so no flag for that!
|
||||
}
|
||||
@@ -116,6 +119,9 @@ bitflags::bitflags! {
|
||||
|
||||
/// If set, the file descriptors received will be placed into the *upper* file table.
|
||||
const UPPER_TBL = 2;
|
||||
|
||||
/// If set, the received file descriptors are marked as close-on-exec.
|
||||
const CLOEXEC = 4;
|
||||
}
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
@@ -404,6 +410,7 @@ bitflags! {
|
||||
const FD_EXCLUSIVE = 1 << 12;
|
||||
const FD_CLONE = 1 << 13;
|
||||
const FD_UPPER = 1 << 14;
|
||||
const FD_CLOEXEC = 1 << 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ pub const SYS_ARG_PATH: usize = 0x0300_0000;
|
||||
pub const SYS_RET: usize = 0x00F0_0000;
|
||||
pub const SYS_RET_FILE: usize = 0x0010_0000;
|
||||
|
||||
pub const SYS_OPEN: usize = SYS_CLASS_PATH | SYS_RET_FILE | 5;
|
||||
pub const SYS_OPENAT: usize = SYS_CLASS_PATH | SYS_RET_FILE | 7;
|
||||
pub const SYS_OPENAT_WITH_FILTER: usize = SYS_CLASS_PATH | SYS_RET_FILE | 985;
|
||||
pub const SYS_UNLINKAT: usize = SYS_CLASS_PATH | 263;
|
||||
|
||||
@@ -99,9 +99,6 @@ impl CqeOpcode {
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Opcode {
|
||||
Open = 0, // path_ptr, path_len (utf8), flags
|
||||
Rmdir = 1, // path_ptr, path_len (utf8)
|
||||
Unlink = 2, // path_ptr, path_len (utf8)
|
||||
Close = 3, // fd
|
||||
Dup = 4, // old fd, buf_ptr, buf_len
|
||||
Read = 5, // fd, buf_ptr, buf_len, TODO offset, TODO flags, _
|
||||
@@ -145,9 +142,6 @@ impl Opcode {
|
||||
|
||||
// TODO: Use a library where this match can be automated.
|
||||
Some(match raw {
|
||||
0 => Open,
|
||||
1 => Rmdir,
|
||||
2 => Unlink,
|
||||
3 => Close,
|
||||
4 => Dup,
|
||||
5 => Read,
|
||||
|
||||
Reference in New Issue
Block a user