[Mono-patches] r64169 - trunk/mcs/class/Mono.Posix/Mono.Unix
Jonathan Pryor
mono-patches-list at lists.ximian.com
Mon Aug 21 18:58:20 EDT 2006
Author: jonpryor
Date: 2006-08-21 18:58:20 -0400 (Mon, 21 Aug 2006)
New Revision: 64169
Modified:
trunk/mcs/class/Mono.Posix/Mono.Unix/ChangeLog
trunk/mcs/class/Mono.Posix/Mono.Unix/UnixStream.cs
Log:
* UnixStream.cs: .Close() shouldn't close(2) the fd unless owner==true;
.Flush() should be a no-op (as System.IO.Stream.Flush doesn't gaurantee
that .Flush() actually flush to disk, and .Flush() slows things down a
lot); see: http://joeshaw.org/2006/08/21/415.
Modified: trunk/mcs/class/Mono.Posix/Mono.Unix/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Posix/Mono.Unix/ChangeLog 2006-08-21 22:50:26 UTC (rev 64168)
+++ trunk/mcs/class/Mono.Posix/Mono.Unix/ChangeLog 2006-08-21 22:58:20 UTC (rev 64169)
@@ -1,3 +1,10 @@
+2006-08-21 Jonathan Pryor <jonpryor at vt.edu>
+
+ * UnixStream.cs: .Close() shouldn't close(2) the fd unless owner==true;
+ .Flush() should be a no-op (as System.IO.Stream.Flush doesn't gaurantee
+ that .Flush() actually flush to disk, and .Flush() slows things down a
+ lot); see: http://joeshaw.org/2006/08/21/415.
+
2006-08-16 Alp Toker <alp at atoker.com>
* UnixEndPoint.cs:
Modified: trunk/mcs/class/Mono.Posix/Mono.Unix/UnixStream.cs
===================================================================
--- trunk/mcs/class/Mono.Posix/Mono.Unix/UnixStream.cs 2006-08-21 22:50:26 UTC (rev 64168)
+++ trunk/mcs/class/Mono.Posix/Mono.Unix/UnixStream.cs 2006-08-21 22:58:20 UTC (rev 64169)
@@ -193,24 +193,6 @@
public override void Flush ()
{
- int r = Native.Syscall.fsync (fileDescriptor);
-
- if (r == -1) {
- Native.Errno e = Native.Stdlib.GetLastError ();
-
- // From the man page:
- // EROFS, EINVAL:
- // fd is bound to a special file which does not support
- // synchronization.
- // Sockets are such a file, and since Close() calls Flush(), and we
- // want to support manually opened sockets, we shouldn't generate an
- // exception for these errors.
- if (e == Native.Errno.EROFS || e == Native.Errno.EINVAL) {
- return;
- }
-
- UnixMarshal.ThrowExceptionForError (e);
- }
}
public override unsafe int Read ([In, Out] byte[] buffer, int offset, int count)
@@ -408,6 +390,10 @@
return;
Flush ();
+
+ if (!owner)
+ return;
+
int r;
do {
r = Native.Syscall.close (fileDescriptor);
More information about the Mono-patches
mailing list