Fix build on Redox

This commit is contained in:
Jeremy Soller
2017-07-09 10:21:20 -06:00
parent 9471a2e410
commit 20bce53b7a
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
use redoxfs::FileSystem;
use std::cmp::{min, max};
use std::time::{SystemTime, UNIX_EPOCH};
use syscall::error::{Error, Result, EBADF, EINVAL};
use syscall::flag::{O_ACCMODE, O_RDONLY, O_WRONLY, O_RDWR, F_GETFL, F_SETFL};
@@ -152,7 +153,8 @@ impl Resource for FileResource {
fn write(&mut self, buf: &[u8], fs: &mut FileSystem) -> Result<usize> {
if self.flags & O_ACCMODE == O_RDWR || self.flags & O_ACCMODE == O_WRONLY {
let count = fs.write_node(self.block, self.seek, buf)?;
let mtime = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let count = fs.write_node(self.block, self.seek, buf, mtime.as_secs(), mtime.subsec_nanos())?;
self.seek += count as u64;
Ok(count)
} else {
+3 -1
View File
@@ -6,6 +6,7 @@ use std::cell::RefCell;
use std::collections::BTreeMap;
use std::str;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
use syscall::data::{Stat, StatVfs};
use syscall::error::{Error, Result, EACCES, EEXIST, EISDIR, ENOTDIR, EPERM, ENOENT, EBADF, ELOOP, EINVAL};
@@ -262,7 +263,8 @@ impl Scheme for FileScheme {
Node::MODE_FILE
};
let mut node = fs.create_node(mode_type | (flags as u16 & Node::MODE_PERM), &last_part, parent.0)?;
let ctime = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let mut node = fs.create_node(mode_type | (flags as u16 & Node::MODE_PERM), &last_part, parent.0, ctime.as_secs(), ctime.subsec_nanos())?;
node.1.uid = uid;
node.1.gid = gid;
fs.write_at(node.0, &node.1)?;