Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2010-04-12 18:09:14 +0400
committerjfrijters <jfrijters>2010-04-12 18:09:14 +0400
commit642a5e1b2d9b8fc311e9d9b35484053220dc3eb2 (patch)
treee8d1a6638a5ef0809ef6ac910df8a8e92d85b1f1 /openjdk/sun/nio/ch
parent47f8f0774977589a46c3b28d06cb0278f4c632f9 (diff)
Use FileDescriptor.sync() instead of duplicating FileStream flushing here.
Diffstat (limited to 'openjdk/sun/nio/ch')
-rw-r--r--openjdk/sun/nio/ch/FileChannelImpl.java33
1 files changed, 1 insertions, 32 deletions
diff --git a/openjdk/sun/nio/ch/FileChannelImpl.java b/openjdk/sun/nio/ch/FileChannelImpl.java
index 036e2cdb..da3ec356 100644
--- a/openjdk/sun/nio/ch/FileChannelImpl.java
+++ b/openjdk/sun/nio/ch/FileChannelImpl.java
@@ -1402,32 +1402,6 @@ public class FileChannelImpl
return p.ToInt64();
}
- private static boolean flushWin32(FileStream fs)
- {
- int rc = FlushFileBuffers(fs.get_SafeFileHandle());
- cli.System.GC.KeepAlive(fs);
- return rc != 0;
- }
-
- private static boolean flushPosix(FileStream fs)
- {
- Type t = Type.GetType("Mono.Posix.Syscall, Mono.Posix");
- if(t != null)
- {
- BindingFlags flags = BindingFlags.wrap(BindingFlags.Public | BindingFlags.Static);
- MethodInfo mono_1_1_Flush = t.GetMethod("fsync", flags, null, new Type[] { Type.GetType("System.Int32") }, new ParameterModifier[0]);
- if(mono_1_1_Flush != null)
- {
- Object[] args = new Object[] { ikvm.lang.CIL.box_int(fs.get_Handle().ToInt32()) };
- return ikvm.lang.CIL.unbox_int(mono_1_1_Flush.Invoke(null, args)) == 0;
- }
- }
- return true;
- }
-
- @DllImportAttribute.Annotation("kernel32")
- private static native int FlushFileBuffers(SafeFileHandle handle);
-
@DllImportAttribute.Annotation(value="kernel32", SetLastError=true)
private static native SafeFileHandle CreateFileMapping(SafeFileHandle hFile, IntPtr lpAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, String lpName);
@@ -1463,12 +1437,7 @@ public class FileChannelImpl
// Forces output to device
private static int force0(FileDescriptor fd, boolean metaData) throws IOException
{
- FileStream fs = (FileStream)fd.getStream();
- boolean rc = win32 ? flushWin32(fs) : flushPosix(fs);
- if (!rc)
- {
- throw new IOException("Force failed");
- }
+ fd.sync();
return 0;
}