Match RFC spec

This commit is contained in:
Jeremy Soller
2016-11-25 12:05:30 -07:00
parent cc90408d14
commit 2835586ee6
3 changed files with 27 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "redox_syscall"
version = "0.1.9"
version = "0.1.10"
description = "A Rust library to access raw Redox system calls"
license = "MIT"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]

View File

@@ -131,6 +131,11 @@ pub fn getegid() -> Result<usize> {
unsafe { syscall0(SYS_GETEGID) }
}
/// Get the effective namespace
pub fn getens() -> Result<usize> {
unsafe { syscall0(SYS_GETENS) }
}
/// Get the effective user ID
pub fn geteuid() -> Result<usize> {
unsafe { syscall0(SYS_GETEUID) }
@@ -141,6 +146,11 @@ pub fn getgid() -> Result<usize> {
unsafe { syscall0(SYS_GETGID) }
}
/// Get the current namespace
pub fn getns() -> Result<usize> {
unsafe { syscall0(SYS_GETNS) }
}
/// Get the current process ID
pub fn getpid() -> Result<usize> {
unsafe { syscall0(SYS_GETPID) }
@@ -176,6 +186,11 @@ pub fn mkdir(path: &str, mode: u16) -> Result<usize> {
unsafe { syscall3(SYS_MKDIR, path.as_ptr() as usize, path.len(), mode as usize) }
}
/// Make a new scheme namespace
pub fn mkns(schemes: &[[usize; 2]]) -> Result<usize> {
unsafe { syscall2(SYS_MKNS, schemes.as_ptr() as usize, schemes.len()) }
}
/// Sleep for the time specified in `req`
pub fn nanosleep(req: &TimeSpec, rem: &mut TimeSpec) -> Result<usize> {
unsafe { syscall2(SYS_NANOSLEEP, req as *const TimeSpec as usize, rem as *mut TimeSpec as usize) }
@@ -226,16 +241,16 @@ pub fn setregid(rgid: usize, egid: usize) -> Result<usize> {
unsafe { syscall2(SYS_SETREGID, rgid, egid) }
}
/// Make a new scheme namespace
pub fn setrens(rns: usize, ens: usize) -> Result<usize> {
unsafe { syscall2(SYS_SETRENS, rns, ens) }
}
/// Set the current process user IDs
pub fn setreuid(ruid: usize, euid: usize) -> Result<usize> {
unsafe { syscall2(SYS_SETREUID, ruid, euid) }
}
/// Create and set a new scheme namespace
pub fn setns(schemes: &[[usize; 2]]) -> Result<usize> {
unsafe { syscall2(SYS_SETNS, schemes.as_ptr() as usize, schemes.len()) }
}
/// Remove a file
pub fn unlink(path: &str) -> Result<usize> {
unsafe { syscall2(SYS_UNLINK, path.as_ptr() as usize, path.len()) }

View File

@@ -41,12 +41,15 @@ pub const SYS_EXIT: usize = 1;
pub const SYS_FUTEX: usize = 240;
pub const SYS_GETCWD: usize = 183;
pub const SYS_GETEGID: usize = 202;
pub const SYS_GETENS: usize = 951;
pub const SYS_GETEUID: usize = 201;
pub const SYS_GETGID: usize = 200;
pub const SYS_GETNS: usize = 950;
pub const SYS_GETPID: usize = 20;
pub const SYS_GETUID: usize = 199;
pub const SYS_IOPL: usize = 110;
pub const SYS_KILL: usize = 37;
pub const SYS_MKNS: usize = 984;
pub const SYS_NANOSLEEP: usize =162;
pub const SYS_PHYSALLOC: usize =945;
pub const SYS_PHYSFREE: usize = 946;
@@ -54,8 +57,8 @@ 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_SETREGID: usize = 204;
pub const SYS_SETREUID: usize = 203;
pub const SYS_SETNS: usize = 310;
pub const SYS_SETREGID: usize = 204;
pub const SYS_SETRENS: usize = 952;
pub const SYS_SETREUID: usize = 203;
pub const SYS_WAITPID: usize = 7;
pub const SYS_YIELD: usize = 158;