X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FRuntime.java;h=1b2e3722dd1a846b19fe92a40495e8ffd1a40457;hp=5c2cc6a271b57db0ff77284b4d1bff66f07e6227;hb=93a2800b2ea08fae92a738eeedd43580e1446c8d;hpb=d309b21d2ee150a9f426c7d22a5ce6d392b59d26 diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index 5c2cc6a..1b2e372 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -704,6 +704,20 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { 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; + + // release all fcntl locks on this file + Seekable s = fds[fdn].seekable(); + if (s != null) { + try { + for (int i=0; i < LOCK_MAX; i++) { + if (locks[i] != null && s.equals(locks[i].seekable())) { + locks[i].release(); + locks[i] = null; + } + } + } catch (IOException e) { throw new RuntimeException(e); } + } + fds[fdn].close(); fds[fdn] = null; return true;