Compile on non-redox platforms but return ENOSYS for all system calls

This commit is contained in:
Jeremy Soller
2019-07-04 07:44:09 -06:00
parent 43c562a921
commit e3fd644ba9
3 changed files with 40 additions and 6 deletions

View File

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

31
src/arch/nonredox.rs Normal file
View File

@@ -0,0 +1,31 @@
use super::error::{Error, Result, ENOSYS};
pub unsafe fn syscall0(_a: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
pub unsafe fn syscall1(_a: usize, _b: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
// Clobbers all registers - special for clone
pub unsafe fn syscall1_clobber(_a: usize, _b: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
pub unsafe fn syscall2(_a: usize, _b: usize, _c: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
pub unsafe fn syscall3(_a: usize, _b: usize, _c: usize, _d: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
pub unsafe fn syscall4(_a: usize, _b: usize, _c: usize, _d: usize, _e: usize) -> Result<usize> {
Err(Error::new(ENOSYS))
}
pub unsafe fn syscall5(_a: usize, _b: usize, _c: usize, _d: usize, _e: usize, _f: usize)
-> Result<usize> {
Err(Error::new(ENOSYS))
}

View File

@@ -1,4 +1,3 @@
#![cfg(target_os = "redox")]
#![feature(asm)]
#![feature(const_fn)]
#![cfg_attr(not(test), no_std)]
@@ -15,22 +14,26 @@ pub use self::io::*;
pub use self::number::*;
pub use self::scheme::*;
#[cfg(target_arch = "arm")]
#[cfg(all(target_os = "redox", target_arch = "arm"))]
#[path="arch/arm.rs"]
mod arch;
#[cfg(target_arch = "aarch64")]
#[cfg(all(target_os = "redox", target_arch = "aarch64"))]
#[path="arch/aarch64.rs"]
mod arch;
#[cfg(target_arch = "x86")]
#[cfg(all(target_os = "redox", target_arch = "x86"))]
#[path="arch/x86.rs"]
mod arch;
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_os = "redox", target_arch = "x86_64"))]
#[path="arch/x86_64.rs"]
mod arch;
#[cfg(not(target_os = "redox"))]
#[path="arch/nonredox.rs"]
mod arch;
/// Function definitions
pub mod call;