Fixes for Redox when part of unix target family
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ doc = false
|
||||
redox_syscall = "0.1"
|
||||
uuid = { version = "0.5", features = ["v4"] }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
[target.'cfg(not(target_os = "redox"))'.dependencies]
|
||||
fuse = "0.3"
|
||||
libc = "0.2"
|
||||
time = "0.1"
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
#![deny(warnings)]
|
||||
#![cfg_attr(unix, feature(libc))]
|
||||
#![cfg_attr(not(target_os = "redox"), feature(libc))]
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
extern crate libc;
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
@@ -13,7 +13,7 @@ extern crate uuid;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
use std::os::unix::io::FromRawFd;
|
||||
use std::os::unix::io::{FromRawFd, RawFd};
|
||||
use std::process;
|
||||
|
||||
use redoxfs::{DiskCache, DiskFile, mount};
|
||||
@@ -41,18 +41,18 @@ fn setsig() {
|
||||
sigaction(SIGTERM, Some(&sig_action), None).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
// on linux, this is implemented properly, so no need for this unscrupulous nonsense!
|
||||
fn setsig() {
|
||||
()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
fn fork() -> isize {
|
||||
unsafe { libc::fork() as isize }
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
fn pipe(pipes: &mut [i32; 2]) -> isize {
|
||||
unsafe { libc::pipe(pipes.as_mut_ptr()) as isize }
|
||||
}
|
||||
@@ -254,8 +254,8 @@ fn main() {
|
||||
|
||||
let mut pipes = [0; 2];
|
||||
if pipe(&mut pipes) == 0 {
|
||||
let mut read = unsafe { File::from_raw_fd(pipes[0]) };
|
||||
let write = unsafe { File::from_raw_fd(pipes[1]) };
|
||||
let mut read = unsafe { File::from_raw_fd(pipes[0] as RawFd) };
|
||||
let write = unsafe { File::from_raw_fd(pipes[1] as RawFd) };
|
||||
|
||||
let pid = fork();
|
||||
if pid == 0 {
|
||||
|
||||
+3
-3
@@ -4,13 +4,13 @@ use std::path::Path;
|
||||
use disk::Disk;
|
||||
use filesystem::FileSystem;
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
mod fuse;
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
mod redox;
|
||||
|
||||
#[cfg(all(unix, target_os = "macos"))]
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> {
|
||||
use std::ffi::OsStr;
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou
|
||||
])
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
#[cfg(all(not(target_os = "macos"), not(target_os = "redox")))]
|
||||
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> {
|
||||
fuse::mount(filesystem, mountpoint, callback, &[])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user