summaryrefslogtreecommitdiff
path: root/src/mscorlib
diff options
context:
space:
mode:
authorIan Hays <ianha@microsoft.com>2016-11-18 10:50:17 -0800
committerIan Hays <ianha@microsoft.com>2016-11-18 10:50:17 -0800
commitcbe5f4b7cbbd4d04e9903afbd46981e105973e53 (patch)
treeb229f6f4c37437458207780a8f858b6fc63796c7 /src/mscorlib
parent233c58ca964e15e6ce1e756940ec59819d797edf (diff)
downloadcoreclr-cbe5f4b7cbbd4d04e9903afbd46981e105973e53.tar.gz
coreclr-cbe5f4b7cbbd4d04e9903afbd46981e105973e53.tar.bz2
coreclr-cbe5f4b7cbbd4d04e9903afbd46981e105973e53.zip
Update with corefx PR changes
Diffstat (limited to 'src/mscorlib')
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs11
-rw-r--r--src/mscorlib/corefx/System/IO/FileStream.Unix.cs4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs
index 1dc003b28a..e0b22e413c 100644
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs
+++ b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs
@@ -9,10 +9,13 @@ internal static partial class Interop
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LockFileRegion", SetLastError=true)]
- internal static extern int LockFileRegion(SafeHandle fd, long offset, long length);
+ internal enum LockType : short
+ {
+ F_UNLCK = 2, // unlock
+ F_WRLCK = 3 // exclusive or write lock
+ }
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_UnlockFileRegion", SetLastError=true)]
- internal static extern int UnlockFileRegion(SafeHandle fd, long offset, long length);
+ [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LockFileRegion", SetLastError=true)]
+ internal static extern int LockFileRegion(SafeHandle fd, long offset, long length, LockType lockType);
}
}
diff --git a/src/mscorlib/corefx/System/IO/FileStream.Unix.cs b/src/mscorlib/corefx/System/IO/FileStream.Unix.cs
index f11f97c795..f83fc84259 100644
--- a/src/mscorlib/corefx/System/IO/FileStream.Unix.cs
+++ b/src/mscorlib/corefx/System/IO/FileStream.Unix.cs
@@ -801,7 +801,7 @@ namespace System.IO
/// <param name="length">The range to be locked.</param>
private void LockInternal(long position, long length)
{
- CheckFileCall(Interop.Sys.LockFileRegion(_fileHandle, position, length));
+ CheckFileCall(Interop.Sys.LockFileRegion(_fileHandle, position, length, Interop.Sys.LockType.F_WRLCK));
}
/// <summary>Allows access by other processes to all or part of a file that was previously locked.</summary>
@@ -809,7 +809,7 @@ namespace System.IO
/// <param name="length">The range to be unlocked.</param>
private void UnlockInternal(long position, long length)
{
- CheckFileCall(Interop.Sys.UnlockFileRegion(_fileHandle, position, length));
+ CheckFileCall(Interop.Sys.LockFileRegion(_fileHandle, position, length, Interop.Sys.LockType.F_UNLCK));
}
/// <summary>Sets the current position of this stream to the given value.</summary>