[Mono-dev] Cross-platform fsync()

Patrick Earl mono at patearl.net
Wed Jan 10 17:52:29 EST 2007


If I wanted to add this functionality to the mono class library so no
p/invokes are required, does anyone have any suggestions where it
should be added?  I've seen most new functionality added to Mono.*
classes, but I don't see anything like Mono.IO.  Are there any
guidelines on where something like this might go?

       Patrick

On 1/9/07, Robert Jordan <robertj at gmx.net> wrote:
> On MS.NET and Mono for Windows, the proper function is WIN32's
> FlushFileBuffers()that can be called via p/invoke from kernel32.dll
> either on FileStream.Handle, or (.NET 2.0) on FileStream.SafeFileHandle.
>
> On Linux, FlushFileBuffers() is provided by Mono's WAPI layer
> that calls fsync(2) internally, but I don't know how it can be
> called from managed code. Maybe like this (untested):
>
> [DllImport("__Internal")]
> public static bool FlushFileBuffers (IntPtr handle);
>
> For .NET 2.0:
> [DllImport("__Internal")]
> public static bool FlushFileBuffers (SafeFileHandle handle);



More information about the Mono-devel-list mailing list