From 6dffd40f3d89d06e8de1fdccd57bfc080404296b Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 28 Oct 2006 02:41:30 +0000 Subject: [PATCH] Flush command added --- Robust/src/ClassLibrary/FileOutputStream.java | 5 +++++ Robust/src/Runtime/file.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Robust/src/ClassLibrary/FileOutputStream.java b/Robust/src/ClassLibrary/FileOutputStream.java index ed81ed7c..031634ff 100644 --- a/Robust/src/ClassLibrary/FileOutputStream.java +++ b/Robust/src/ClassLibrary/FileOutputStream.java @@ -21,6 +21,7 @@ public class FileOutputStream { private static native int nativeAppend(byte[] filename); private static native void nativeWrite(int fd, byte[] array); private static native void nativeClose(int fd); + private static native void nativeFlush(int fd); public void write(int ch) { byte b[]=new byte[1]; @@ -32,6 +33,10 @@ public class FileOutputStream { nativeWrite(fd, b); } + public void flush() { + nativeFlush(fd); + } + public void close() { nativeClose(fd); } diff --git a/Robust/src/Runtime/file.c b/Robust/src/Runtime/file.c index fa8343dc..88cd585c 100644 --- a/Robust/src/Runtime/file.c +++ b/Robust/src/Runtime/file.c @@ -17,6 +17,10 @@ void ___FileOutputStream______nativeClose____I(int fd) { close(fd); } +void ___FileOutputStream______nativeFlush____I(int fd) { + fsync(fd); +} + int ___FileOutputStream______nativeOpen_____AR_B(struct ArrayObject * ao) { int length=ao->___length___; char* filename= (((char *)& ao->___length___)+sizeof(int)); -- 2.34.1