Skip to content

Commit

Permalink
Fix ion build on Redox
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Jul 27, 2017
1 parent 8242066 commit d7e1a44
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/sys/redox.rs
Expand Up @@ -15,11 +15,9 @@ pub const SIGCONT: i32 = syscall::SIGCONT as i32;
pub const SIGSTOP: i32 = syscall::SIGSTOP as i32;
pub const SIGTSTP: i32 = syscall::SIGTSTP as i32;

/// XXX: These values were infered from the Redox port of `newlib` and may be
/// sensitive to changes in redox;
pub const STDIN_FILENO: i32 = 0;
pub const STDOUT_FILENO: i32 = 1;
pub const STDERR_FILENO: i32 = 2;
pub const STDIN_FILENO: RawFd = 0;
pub const STDOUT_FILENO: RawFd = 1;
pub const STDERR_FILENO: RawFd = 2;

pub unsafe fn fork() -> io::Result<u32> {
cvt(syscall::clone(0)).map(|pid| pid as u32)
Expand Down Expand Up @@ -73,15 +71,15 @@ pub fn tcsetpgrp(tty_fd: RawFd, pgid: u32) -> io::Result<()> {
}

pub fn dup(fd: RawFd) -> io::Result<RawFd> {
syscall::call::dup(fd, &[]).map_err(|e| io::Error::from_raw_os_error(err.errno))
cvt(syscall::dup(fd, &[]))
}

pub fn dup2(old: RawFd, new: RawFd) -> io::Result<RawFd> {
syscall::call::dup2(old, new, &[]).map_err(|e| io::Error::from_raw_os_err(err.errno))
cvt(syscall::dup2(old, new, &[]))
}

pub fn close(fd: RawFd) -> io::Result<()> {
cvt(syscall::call::close(fd)).and(Ok())
cvt(syscall::close(fd)).and(Ok(()))
}

// Support function for converting syscall error to io error
Expand Down

0 comments on commit d7e1a44

Please sign in to comment.