Verified Commit 4343ac6b authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Update to newer syscall

parent ec847e30
......@@ -15,8 +15,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.1.56"
source = "git+https://gitlab.redox-os.org/redox-os/syscall.git#8d0015be8693a81c2a4459f3c09fb47b98ff07b1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bac5c4ce99d34f37ce30e45606946fcd6331223f1c98af4d29c5b6c4977d675b"
dependencies = [
"bitflags",
]
......@@ -7,4 +7,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
redox_syscall = { git = "https://gitlab.redox-os.org/redox-os/syscall.git" }
redox_syscall = "0.2"
......@@ -293,21 +293,18 @@ impl SchemeMut for Scheme {
Err(Error::new(EISDIR))
}
}
fn seek(&mut self, fd: usize, pos: usize, whence: usize) -> Result<usize> {
fn seek(&mut self, fd: usize, pos: isize, whence: usize) -> Result<isize> {
let handle = self.handles.get_mut(&fd).ok_or(Error::new(EBADF))?;
let file = self.filesystem.files.get_mut(&handle.inode).ok_or(Error::new(EBADFD))?;
// cast to isize, possibly making the offset negative
let pos = pos as isize;
let old = handle.offset;
handle.offset = match whence {
SEEK_SET => cmp::max(0, pos) as usize,
SEEK_CUR => cmp::max(0, pos + isize::try_from(handle.offset).or(Err(Error::new(EOVERFLOW)))?) as usize,
SEEK_END => cmp::max(0, pos + isize::try_from(file.data.size()).or(Err(Error::new(EOVERFLOW)))?) as usize,
SEEK_SET => cmp::max(0, pos),
SEEK_CUR => cmp::max(0, pos + isize::try_from(handle.offset).or(Err(Error::new(EOVERFLOW)))?),
SEEK_END => cmp::max(0, pos + isize::try_from(file.data.size()).or(Err(Error::new(EOVERFLOW)))?),
_ => return Err(Error::new(EINVAL)),
};
Ok(handle.offset)
} as usize;
Ok(handle.offset as isize)
}
fn fchmod(&mut self, fd: usize, mode: u16) -> Result<usize> {
let handle = self.handles.get_mut(&fd).ok_or(Error::new(EBADF))?;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment