projects
/
nestedvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
69dfc6b
)
avoid file length caching in fstat (from Joe Wilson)
author
David Crawshaw
<david@zentus.com>
Sat, 30 Jun 2007 10:31:53 +0000
(
03:31
-0700)
committer
David Crawshaw
<david@zentus.com>
Sat, 30 Jun 2007 10:31:53 +0000
(
03:31
-0700)
darcs-hash:
20070630103153
-0c629-
f1537fc9c5fa693bee5a15b0e7bf6ed4f8e24387
.gz
src/org/ibex/nestedvm/Runtime.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/nestedvm/Runtime.java
b/src/org/ibex/nestedvm/Runtime.java
index
201fde9
..
8e6b5f0
100644
(file)
--- a/
src/org/ibex/nestedvm/Runtime.java
+++ b/
src/org/ibex/nestedvm/Runtime.java
@@
-767,10
+767,10
@@
public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
return null;
} catch(IOException e) { throw new ErrnoException(EIO); }
return null;
} catch(IOException e) { throw new ErrnoException(EIO); }
- return new SeekableFD(sf,flags) { protected FStat _fstat() { return hostFStat(f,data); } };
+ return new SeekableFD(sf,flags) { protected FStat _fstat() { return hostFStat(f,sf,data); } };
}
}
- FStat hostFStat(File f, Object data) { return new HostFStat(f); }
+ FStat hostFStat(File f, Seekable.File sf, Object data) { return new HostFStat(f,sf); }
FD hostFSDirFD(File f, Object data) { return null; }
FD hostFSDirFD(File f, Object data) { return null; }
@@
-1413,10
+1413,13
@@
public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
static class HostFStat extends FStat {
private final File f;
static class HostFStat extends FStat {
private final File f;
+ private final Seekable.File sf;
private final boolean executable;
private final boolean executable;
- public HostFStat(File f) { this(f,false); }
- public HostFStat(File f, boolean executable) {
+ public HostFStat(File f, Seekable.File sf) { this(f,sf,false); }
+ public HostFStat(File f, boolean executable) {this(f,null,executable);}
+ public HostFStat(File f, Seekable.File sf, boolean executable) {
this.f = f;
this.f = f;
+ this.sf = sf;
this.executable = executable;
}
public int dev() { return 1; }
this.executable = executable;
}
public int dev() { return 1; }
@@
-1431,7
+1434,13
@@
public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
if(f.canWrite()) mode |= 0222;
return mode;
}
if(f.canWrite()) mode |= 0222;
return mode;
}
- public int size() { return (int) f.length(); }
+ public int size() {
+ try {
+ return sf != null ? (int)sf.length() : (int)f.length();
+ } catch (Exception x) {
+ return (int)f.length();
+ }
+ }
public int mtime() { return (int)(f.lastModified()/1000); }
}
public int mtime() { return (int)(f.lastModified()/1000); }
}