[corlib] Fix sharing mode validation rules (#16247)
Fixes https://github.com/mono/mono/issues/16032
When we switched to corefx File.Copy on unix, the behavior changed where it opened a source and destination stream in order to pass the safe handles to Interop.Sys.CopyFile. This exposed a flaw in our sharing validation rules in MonoIO.Open, which threw an exception in this scenario:
new FileStream("source.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, 2048, FileOptions.DeleteOnClose);
new FileStream("source.txt", FileMode.Open, FileAccess.Read, FileShare.Read, 2048, FileOptions.None);
Simplified the FileShare check down to:
1. If the caller specifies FileShare.None, then it's an exclusive lock and no
sharing is allowed.
2. If the caller specifies some other FileShare option, then FileShare.None
cannot be specified.