X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FRuntime.java;h=2a91e3613ebda8733909fef05888a0aa83b9ce50;hp=8e6b5f019572dd2e0c8ed0fa3c7c5f70c56e0f00;hb=b11e7c6c29f2b5f7b0828bf93eb741c4a30ec411;hpb=17cbaf0d981ab9c6f1b0b42fc40b20d00f91e417 diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index 8e6b5f0..2a91e36 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -1,5 +1,5 @@ // Copyright 2000-2005 the Contributors, as shown in the revision logs. -// Licensed under the Apache Public Source License 2.0 ("the License"). +// Licensed under the Apache License 2.0 ("the License"). // You may not use this file except in compliance with the License. // Copyright 2003 Brian Alliet @@ -698,18 +698,18 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { return i; } - /** Hook for subclasses to do something when the process closes an FD */ - void _closedFD(FD fd) { } + /** Hooks for subclasses before and after the process closes an FD */ + void _preCloseFD(FD fd) { } + void _postCloseFD(FD fd) { } /** Closes file descriptor fdn and removes it from the file descriptor table */ public final boolean closeFD(int fdn) { if(state == EXITED || state == EXECED) throw new IllegalStateException("closeFD called in inappropriate state"); if(fdn < 0 || fdn >= OPEN_MAX) return false; if(fds[fdn] == null) return false; - - _closedFD(fds[fdn]); - + _preCloseFD(fds[fdn]); fds[fdn].close(); + _postCloseFD(fds[fdn]); fds[fdn] = null; return true; } @@ -1209,6 +1209,14 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { /** File Descriptor class */ public static abstract class FD { private int refCount = 1; + private String normalizedPath = null; + private boolean deleteOnClose = false; + + public void setNormalizedPath(String path) { normalizedPath = path; } + public String getNormalizedPath() { return normalizedPath; } + + public void markDeleteOnClose() { deleteOnClose = true; } + public boolean isMarkedForDeleteOnClose() { return deleteOnClose; } /** Read some bytes. Should return the number of bytes read, 0 on EOF, or throw an IOException on error */ public int read(byte[] a, int off, int length) throws ErrnoException { throw new ErrnoException(EBADFD); }