Commit Graph
176 Commits
Author SHA1 Message Date
Deepak Shankargouda f5284f6fcc Created initial set of .builds files
Commit migrated from https://github.com/dotnet/corefx/commit/a20fd22b1e44d13e437c235a957a47a2af52838d
2015-12-02 14:38:03 -08:00
Pat Gavlin 9c51408169 Minor changes to the Poll() shim.
- Minor cosmetic changes to the Poll() datatypes
- Change the Poll() shim to return an Error instead of an errno.
  The number of triggered file descriptors is now an output
  parameter.
- Fix the implementation of Poll() to handle > 2 poll events.

This change is preparing for a future change that will move
Socket.{Select,Poll} to use `poll` instead of `select`.


Commit migrated from https://github.com/dotnet/corefx/commit/4b789b544cd66315a12ee81a214c5299f295c54c
2015-11-30 16:22:16 -08:00
Eric St. John 65210efd31 Update project.lock.json to latest and lock
Commit migrated from https://github.com/dotnet/corefx/commit/6aeea5eabf2aff3baf15f501cabd156dfc5b3f8f
2015-11-09 22:38:10 -08:00
Eric St. John cddddd29f5 Remove unused dependencies
Commit migrated from https://github.com/dotnet/corefx/commit/78fd45ec74afc507a40df519b4df650ac9bd4c42
2015-11-09 22:37:37 -08:00
Pat Gavlin d83224ad45 Change file casing to fix the build on *nix.
Commit migrated from https://github.com/dotnet/corefx/commit/94bf9ba19922a06640a3d1b1e412fb6cbbc676b5
2015-11-09 14:50:43 -08:00
stephentoub 202815712c Enable building all of corefx with an "unknown" Unix
After all of the shim work that's been done, the vast majority of corefx assemblies now are either platform-agnostic or have a Windows build and a Unix build, without further specialization based on OS in managed code.  We do still have a few such assemblies, though (and this is unlikely to change any time soon):
- System.Diagnostics.Process
- System.IO.FileSystem.Watcher
- System.Net.NetworkInformation
- System.Runtime.InteropServices.RuntimeInformation

As a result, attempting to do a full build for Unix targets other than Linux or OS X currently results in compilation failures. This commit adds a new TargetsUnknownUnix property to the build as well as stub implementations that throw PlatformNotSupportedException for all of the missing functionality that causes such compilation errors.

With this change, doing ```build.cmd /p:SkipTests=true /p:OSGroup=FreeBSD" now completes successfully, as does ```build.cmd /p:SkipTests=true /p:OSGroup=Stephenix```.


Commit migrated from https://github.com/dotnet/corefx/commit/3e9f21b5f32e88925d97b928b9456f4cf8f5a1f5
2015-11-07 10:39:52 -08:00
Jon Miller d5b8abd1cf Moving some less-reliable FSW tests out to OuterLoop
Commit migrated from https://github.com/dotnet/corefx/commit/0da52d55f2ddd61daf95c5378f95a5003066e7b4
2015-10-30 14:21:32 -07:00
Eric St. John 88bb5f032c Raise generation of refs to match min generation of all impl.
Previously generations were strictly calculated.  We had a set
of seed assemblies which defined generation boundaries based
on where they were supported. Eg: System.Runtime 4.0.0.0 was
supported inbox in Net45, 4.0.10.0 was supported inbox in
Net451, we could not OOB 4.0.0.0 to Net451 due to unification
so that defined a generation boundary.

All non-seed assemblies got the maximum generation
of all their transitive dependencies.

This worked fine, but created a confusing picture when
looking at the packages.  New contracts that were only
implemented in DNXCore50 and Net46 had a reference assembly
that claimed to be dotnet5.1 even though they weren't
supported by any framework that was exclusive to 5.1-5.3.
It also meant that targeting a generation required that
someone use guardrails to ensure that they'd actually have
an implementation on any framework targeting that generation.
Without guardrails they might produce an assembly that would
not run on any framework of the generation it claimed.

This change raises the generation of all the reference assemblies
to a minimum that supports any implementation.  This makes it
clear which generation of frameworks support the package,
it also lets someone target that generation without using guardrails
and guarantees that they'll at least run somewhere.

[tfs-changeset: 1543192]


Commit migrated from https://github.com/dotnet/corefx/commit/1c8144920c62e89f77567a16ebfa8c1324e52f07
2015-10-29 11:42:25 -07:00
Eric Erhardt 27bc21d469 Add shims for the rest of the libc native calls.
This removes all direct dependencies from managed code
to native libc functions.

Fix dotnet/corefx#4106


Commit migrated from https://github.com/dotnet/corefx/commit/7077b4d74707b9e07787b5fbc1fbe6a0db202ea9
2015-10-28 09:30:41 -05:00
Eric St. John 8cc3c24b51 Update lock files that were missed in previous restore.
A change was made to DNX to no longer restore project.jsons
that are in nested folders.  This caused my batch update to miss
a number of tests and reference assembly projects.

This fixes the stale lock files, but restore is still broken.

[tfs-changeset: 1540448]


Commit migrated from https://github.com/dotnet/corefx/commit/3622cccc1b22fa1947a72d5126b59864e9d2fd0d
2015-10-21 18:59:09 -07:00
Eric St. John 543808303a Update dnx to v1.0.0-rc1-15838, update dotnet projects to generations
We need a new DNX to understand the latest packages.

We also need to move all "dotnet" projects to use dotnetX.X (generations)
now that the packages no longer have "dotnet" assets.

The new version of DNX dropped support for the aspnetcore
so I needed to update a few projects/packages that depended
on old package versions that had this moniker.

[tfs-changeset: 1540388]


Commit migrated from https://github.com/dotnet/corefx/commit/38f8d7a3ca1ee819c2b8eabb1c07ee4e99683c97
2015-10-21 17:03:48 -07:00
bartonjs a768025131 Update all project.lock.json files
Built Windows_NT, Linux, OSX with /p:LockDependencies=true.

CoreFX beta-* => 23419
xunit.netcore.extensions => 00107


Commit migrated from https://github.com/dotnet/corefx/commit/a14b22705df253508bd5f2dab0407bd2c7e4d639
2015-10-19 16:00:44 -07:00
Eric St. John 8cd3109d56 Switch from using "dotnet" to using "dotnet<generation>"
All projects that previously used dotnet have been updated to specify the appropriate generation of the surface area they depend on or in the case of desktop inbox contracts, the generation that includes the set of platforms they can support.

Now all packages contain all generations of API that they have ever shipped.

In doing this I needed to change how we determine package version.  Before we ensured all assemblies would have the same version and used that.  Now we choose the max.

Additionally I needed to change how we chose which asset to use for netcore50 when the dotnet asset was obscured by a placeholder for a previous netcore release (eg System.Runtime will have placeholders for Win8 since it was inbox there).  To do this I wrote a task that uses nuget to evaluate the package assets with and without the placeholders.  In this way it chooses the "best" dotnet implementation and reference assembly to use for netcore50.

This new model made my old MSBuild-based validation impossible to carry forward, so I wrote better validation in a task that actually uses Nuget's asset resolution algorithm.  This uncovered many existing issues in packages that I have cleaned up.  The validation algorithm could use some polish but its working now.  Perf is not great, package build went from 15s to ~2 minutes.  I'll work on this some more by making it incremental (input: nuspec, output: marker created on success).  Profiling shows that most of the time is spent in calling the nuget APIs.  I'll see if I can reduce some of this with caching for things that don't change (eg: RID graph).  Ultimately I think its a reasonable tradeoff for the types of bugs I can find this way.

[tfs-changeset: 1539216]


Commit migrated from https://github.com/dotnet/corefx/commit/0931c347eb836c9da94d0d5ff9ad7a14403b9738
2015-10-18 21:12:23 -07:00
stephentoub db5ceb3a81 Remove NotImplemented.cs from several projects
A handful of projects are still including NotImplemented.cs even though they no longer need it.


Commit migrated from https://github.com/dotnet/corefx/commit/8b6e00ac6c376e7ec041e84270d518ca523a32a3
2015-10-08 08:50:35 -04:00
Peter Jas a29604278c code: Fixes occurred spelling.
Fixes dotnet/corefx#3661.


Commit migrated from https://github.com/dotnet/corefx/commit/544a3885ff51e04db89b70e3f155be1a5c64f166
2015-10-06 15:27:09 +00:00
stephentoub 613a87d035 Add explicit 0 index args to Array.Copy usage
Array.Copy is implemented to work with any System.Array, not just T[].  When Array.Copy(sourceArr, destArray, length) is used, it delegates to Copy(sourceArr, sourceIndex, destArray, destIndex, length), and as such needs to query for the lower-bound of the supplied arrays, since although a T[] in C# always has a lower-bound of 0, an arbitrary Array may not.  Given this, when calling Array.Copy, instead of calling Array.Copy(src, dest, length), it's slightly more efficient to just call Array.Copy(src, 0, dest, 0, length), avoiding the need for the GetLowerBound calls made while delegating to the 5-arg version.

I noticed one occurrence of this in some code I was looking at, and while fixing that, I fixed all of them across corefx\src.


Commit migrated from https://github.com/dotnet/corefx/commit/979026e435672e611e3f6e0647c873aa96ccc684
2015-10-02 13:56:48 -04:00
Ian Hays 0f8197a86c Update CoreFX to xunit 2.1.0
Commit migrated from https://github.com/dotnet/corefx/commit/87b48c58936d66fcb201b3a8ad0961fa055f23b9
2015-10-01 19:56:49 -07:00
bartonjs a52f41057c Update all CoreFx package references to 23328 build.
`build.cmd /p:LockDependencies=true` was the start of this change, but some errors with xunit build numbers led to all xunit upgrades being reset back to what they had in master.

project.json changes:
* System.Net.Security\src Switch off of explicit beta versioning, use the same baseline as everyone else.  The S.S.C.Algorithms explicit upgrade is no longer required.
* System.Net.Requests\tests didn't build.  Looking at the project.lock.json change, it appeared that a System.Net.Http reference was lost, restored it.
* System.Net.Http\tests didn't build. Looking at the project.lock.json change, it appeared that a System.IO.FileSystem reference was lost, restored it.
* System.Net.WebSockets.Client\src didn't build. Looking at the project.lock.json change, it appeared that a System.Collections (4.0.10) reference was lost, restored it.
* System.Diagnostics.TextWriterTraceListener\tests needed the runtime reference to load the correct System.Diagnostics.TraceSource binary.


Commit migrated from https://github.com/dotnet/corefx/commit/cec3a0f2db542bfa9d9c56bf988d966eacc35ad9
2015-09-29 11:40:37 -07:00
stephentoub df23122fde Fix case sensitivity in FSW Path and Filter tests
Changing to use PathInternal.IsCaseSensitive actually fixed a bug in
FSW.Path/Filter.  The tests were testing for the wrong thing on Linux.
This just fixes the tests.


Commit migrated from https://github.com/dotnet/corefx/commit/b24780dd017f9a6a86fd55531fd9410cab6eef8e
2015-09-22 20:16:17 -04:00
stephentoub 02007d2533 Add platform-agnostic case sensitivity detection
After the recent refactoring based on introducing native shims, the only reason there are special builds of System.IO.FileSystem and System.IO.FileSystem.DriveInfo for each of Linux and OS X is because of PathInternal.CaseSensitive/CaseInsensitive.cs, which just provides a hard-coded value as to whether the target platform is case-sensitive or case-insensitive-but-preserving.  Similarly, these files are the only things forcing System.IO.Compression.ZipFile to not be completely platform-agnostic and to have separate Windows/Unix builds.

This commit recombines those assemblies by adding a platform-agnostic helper that simply creates a temporary file with upper-case letters and then checks whether that file can be found via the lower-cased version.  This isn't perfect, in that it's possible to mount multiple file systems each with different case sensitivities, but a) it's better than the hardcoded version we currently have, and b) I don't know of any better portable solution.

(Issue dotnet/corefx#3156 tracks adding an API to provide information on case sensitivity.  This change can be replaced by using such an API if/when it's available.)


Commit migrated from https://github.com/dotnet/corefx/commit/62ba788d4730be24cff0ff0432f43bcc7b9e4561
2015-09-22 12:35:47 -04:00
Christopher Costa cdfa624a04 XPlat packaging
Converts libraries to use platform specific implementations in packages.

[tfs-changeset: 1526941]


Commit migrated from https://github.com/dotnet/corefx/commit/b27061014ebd18d83031039f31721afa35d4612c
2015-09-20 11:57:30 -07:00
Jonathan Miller fb3803dfe9 Finishing up PAL'ing Unix\libc (non-networking and crypto)
PInvoke calls


Commit migrated from https://github.com/dotnet/corefx/commit/f8fd4b7ff731cd8951e6da0bb70ca206533866bb
2015-09-17 13:05:29 -07:00
Wes Haggard a0d524ea1c Merge pull request dotnet/corefx#3177 from akoeplinger/update-dnx
Update build to use DNX beta7 instead of beta5

Commit migrated from https://github.com/dotnet/corefx/commit/34e8271eae1e8cbda5389f6b152c1f27994ca6c2
2015-09-16 10:34:50 -07:00
Nick Guerrera 23277810e6 Increase native compilation warnings and fix the fallout
We were using -Wall but now use -Weverything and opt out of only
a handful of issues such as C++-98 compat, which we don't need.

The most notable impact is that the compiler now catches
narrowing implicit conversions, which was also the primary
motivation for doing this now as there was known debt in our
unsupervised usage of 64-bit types for sizes.

We now assert on bad buffer sizes *and* retain full checks in
release builds to be completely defensive against overflow.

We now use int32_t for scratch buffer sizes. int64_t remains for
file offsets and uint64_t remains for memory mapped files, but
int32_t for scratch eliminates a bunch of managed casts and
therefore makes it easier to reason about overflow prevention.

INT32_MAX is also the most portable limit on these buffer sizes
because the behavior of functions like read is only implementation
defined when the input size is greater than SSIZE_MAX and ssize_t
is int32_t on the lowest common denominator of modern platforms.

Enums corresponding to platform values are now enum X : T instead
of enum class X : T. The PAL_* names are descriptive enough without
scoping and the implicit conversion to raw integer is actually helpful
to avoid a bunch of casts, which are otherwise needed to interop with
the corresponding native API.


Commit migrated from https://github.com/dotnet/corefx/commit/648c01d69fba8d23750122d9823f53257785c8ca
2015-09-16 09:15:33 -07:00
Alexander Köplinger 3e20a867b2 Update build to use DNX beta7 instead of beta5
The corefx build used an older beta5 version of DNX which hardcoded the path to bash in dnu, breaking the build on FreeBSD.
Updating DNX to the latest "stable" beta7 release fixes this.

After updating I noticed a few test projects didn't build anymore as they were missing some dependencies in project.json, added those.

Fixes dotnet/corefx#3173


Commit migrated from https://github.com/dotnet/corefx/commit/6df77fdbb6cf8e0d35a3074bb325f7810085daa3
2015-09-16 02:12:26 +02:00
stephentoub ecb42af61c Disable two FileSystemWatcher tests failing on OS X
Commit migrated from https://github.com/dotnet/corefx/commit/09c31449e82f89bcbe85bd21662692ba43ed6900
2015-09-12 21:41:30 -04:00
Jonathan Miller 9e25edd8d1 Moving more Unix\libc function calls over to the PAL layer
along with fixing up the Interop calls for the switched
functions.


Commit migrated from https://github.com/dotnet/corefx/commit/aed4a23f36ace07e7f5f33bf5a28808fd215fea6
2015-09-11 14:09:37 -07:00
stephentoub 2dd748811e Address various issues in FileSystemWatcher
- On Linux, FileSystemWatcher is built on top of inotify, which has various limits configured in the system for how many instances and watches can be created.  When these limits are hit, exceptions are generated, but the Linux-provided error messages are cryptic about what the problem is.  This change adds better error messages for those cases.  It also ensures that errors regarding watch limits always come out of OnError rather than sometimes being thrown synchronously from EnableRaisingEvents and other times coming out asynchronously.
- As part of fixing that, I noticed that we had some reliability issues around marking the instance as enabled.  I fixed this up to ensure that we only mark the instance as enabled when we've created everything we need to successfully launch it.
- While doing that, I noticed that on OS X, if we restart an FSW, we were unnecessarily re-creating a delegate.  I changed it to avoid the unnecessary allocation.
- And while doing that, I also noticed that we we had a bad exception message when constructing an FSW with something other than a directory.  I fixed the error message.
- I added tests for all these things.


Commit migrated from https://github.com/dotnet/corefx/commit/57cf111281a22feafb83854789680680da3cab50
2015-09-02 16:51:12 -04:00
Jeremy Kuhne 14c82df521 Change file system APIs. to implicitly add extended syntax when needed for long path support.
Commit migrated from https://github.com/dotnet/corefx/commit/fabe699d38702d401fbb237a2608f3054942a8b5
2015-08-27 14:05:05 -07:00
Nick Guerrera 453f5e9697 Remove unused gnu_get_libc_version P/Invoke declaration
This was previously needed for the logic to switch between GNU
strerror_r and POSIX strerror_r, but that is now addressed by the shims.


Commit migrated from https://github.com/dotnet/corefx/commit/ff96ce829df16f8a0b58f568e9b696fa19e698a8
2015-08-27 08:07:54 -07:00
Eric St. John d7a0ae297b Update corefx packages to latest
Commit migrated from https://github.com/dotnet/corefx/commit/23f0b695bd162e0f665427c95180dc21931e5c70
2015-08-14 15:43:23 -07:00
Eric St. John 77309d4821 Update the version of all assemblies
This change updates the assembly versions of all of the corefx assemblies
as needed after we shipped stable versions.  Assemblies with API differences
get a minor version bump.  Assemblies with only bugfixes get a build version
bump.

In order to facilitate this I had to update the reference assemblies, so I took
the opportunity to port them all to the open.

[tfs-changeset: 1514419]


Commit migrated from https://github.com/dotnet/corefx/commit/40723b795917f2e98b64d45c17effb2546dd0cae
2015-08-13 17:07:57 -07:00
stephentoub d0b4035923 Fix regression in FileSystemWatcher
As part of the bug fix in https://github.com/dotnet/corefx/commit/dotnet/corefx@f2720abb758b50a9debb5ec146939ef6f5cef82d , a regression was introduced, one that we didn't catch until recently due to not having a test that stressed stopping and quickly restarting an FSW doing monitoring.

At the time of that fix, the active asynchronous monitoring operation didn't have its own copy of the directory handle; instead, it just used the single field on the FSW instance.  As such, in a race condition between the asynchronous monitoring operation trying to use that instance and the main thread stopping the FSW and nulling out the field, the asynchronous monitoring operation could experience a NullReferenceException.  The fix was to stop nulling out the field and just rely on closing the handle being enough to signal that monitoring should stop.

However, this causes a problem in a particular race condition.  While a SafeHandle is in use by a P/Invoke operation, its reference count is temporarily incremented so as to prevent it from being closed while in use.  This means that if the directory handle is disposed of while it's being used by ReadDirectoryChangesW, the handle's IsClosed won't return true until after ReadDirectoryChangesW returns.  When the FSW is stopped, Dispose is called on the handle, and then when it's restarted, the handle's IsClosed is checked to see if there's currently an active monitoring operation, and if there is, the FSW assumes it doesn't need to restart anything.  But if the stop and the start both occur during the call to ReadDirectoryChangesW, then the start won't actually start anything.

My reliability/performance fixes in https://github.com/dotnet/corefx/commit/dotnet/corefx@b6c478ccc9729e22ac7b9bf2248b644b51883db2 eliminated the reliance on the shared directory handle field: the asynchronous monitoring operation has its own copy.  Thus, there's no longer a problem in nulling out the directory handle field.  The fix for the regression is simply to do so.

(Long explanation for a fix that's simply to null out a field :-)


Commit migrated from https://github.com/dotnet/corefx/commit/6568da5ad7b4e5d516613f6a80865d5e88d72b31
2015-08-13 10:09:40 -04:00
stephentoub a57990e935 Disable sporadically failing FSW test
Issue dotnet/corefx#2740


Commit migrated from https://github.com/dotnet/corefx/commit/1b2143576e06662f65bc5d870bd5a2845afce198
2015-08-12 13:53:55 -04:00
stephentoub 6c5af28f87 Change timeouts on FSW tests
When we're waiting for an event that we know will arrive, we can wait for a fairly long time, because if it doesn't arrive we're going to fail the tests anyway.  This changes makes all of the ExpectEvent calls use a long timeout, much longer than most were previously using.  In the process I removed all of the custom values being passed, as they were all the same or shorter than the new default.  This should help to minimize avoid false positive flakiness.


Commit migrated from https://github.com/dotnet/corefx/commit/81e84b7910244f2f72ba760c100b16c01a38877c
2015-08-11 19:36:20 -04:00
stephentoub a19ac60823 Disable parallelization of FSW tests
My previous change to rename FSW test classes led to FSW tests getting parallelized.  It turns out that some of the tests are not robust against this due to using file names that can end up conflicting with other tests.  Additionally, it appears that the waiting / timeouts used by the tests is very susceptible to failure when run in parallel due to reliance on the shared thread pool, causing more failures in CI.


Commit migrated from https://github.com/dotnet/corefx/commit/83decea6937e1296be20202ff2f8ace51339e958
2015-08-10 23:11:09 -04:00
stephentoub 8ce1a4b748 Allow FSW tests to be parallelized
The FSW tests still take ~10 seconds on my machine, most of which is spent waiting for events to not fire.  This change just separates the tests out so that they're not all on the same class, letting xunit parallelize them.  They now take ~3.5 seconds on my machine.


Commit migrated from https://github.com/dotnet/corefx/commit/2fbabe417accb662a6ed63a40506dea0268cf8e2
2015-08-07 14:17:04 -04:00
stephentoub 06258604cd Remove unnecessarily long wait in FSW tests
One of the FSW tests is passing a 30 second timeout to an ExpectNoEvent, which means the test when correctly functioning will take at least 30 seconds.  I've removed the custom timeout to give the test the normal timeout period of half a second.


Commit migrated from https://github.com/dotnet/corefx/commit/d4d0d561a3978f43ccb2271e8dc417d6d3ffefc2
2015-08-07 14:14:58 -04:00
stephentoub 9b9d1a5566 Fix faulty FileSytemWatcher test
At least on Windows 10, writing to a file can cause directories in its parent directory structure to also be noted as modified, such that events will be raised for those directories.  This is causing the FileSystemWatcher_Changed_PreSeededNestedStructure test to consistently fail.  I've updated the test to instead look for and modify file attributes, instead.


Commit migrated from https://github.com/dotnet/corefx/commit/784403a8cb1afa56136cdc4abd79a5425653c7d8
2015-08-07 14:11:52 -04:00
stephentoub 7c0031ae3d Fix FileSystemWatcher perf/maintainability issues on Windows
- Every iteration of calling ReadDirectoryChangesW was allocating a bunch of state (an FSWAsyncResult, a delegate, a new overlapped, etc).  Fixed to allocate that state once and store it for the duration of the watching operation.
- Every iteration of calling ReadDirectoryChangesW was pinning/unpinning the buffer.  Fixed to use a PreAllocatedOverlapped so that this happens just once for the whole operation.
- Centralized all of the cleanup code of the thread pool binding, and removed the thread pool binding field from the watcher as it's no longer necessary and it risks regressing to the code where we accidentally used the wrong one
- Removed confusing and duplicative flags around whether the implementation is currently running
- Removed duplicate interop code and moved the rest to the Common\src\Interop folder to follow the convention for the rest of the repo
- Made more robust the case where a failure occurs after creating the directory handle and before starting monitoring
- Removed unnecessary locking
- Reorganized some code to make the implementation easier to read, and added comments


Commit migrated from https://github.com/dotnet/corefx/commit/b6c478ccc9729e22ac7b9bf2248b644b51883db2
2015-08-07 13:42:01 -04:00
Stephen Toub 017e6df22d Merge pull request dotnet/corefx#2674 from stephentoub/fix_fsw_threadpoolbinding
Fix FSW freeing of NativeOverlapped on wrong ThreadPoolBoundHandle

Commit migrated from https://github.com/dotnet/corefx/commit/28132be7ebac0166e012e229b77377e669d52462
2015-08-07 08:27:27 -04:00
Nick Guerrera b760fb6fb0 Merge pull request dotnet/corefx#2606 from nguerrera/add-errno-shim
Add errno shim (+ existing shim cleanup precursor)

Commit migrated from https://github.com/dotnet/corefx/commit/b9fc9e6d00fef3e83f2d80951e210b868627c328
2015-08-06 20:41:35 -07:00
stephentoub fab40f1dd4 Fix FSW freeing of NativeOverlapped on wrong ThreadPoolBoundHandle
If a FileSystemWatcher is stopped and restarted while processing events, it can end up trying to free an allocated NativeOverlapped on the ThreadPoolBoundHandle associated with the new session even if it was created with the old one.  This commit changes the code to store the appropriate binding and directory handle in locals and in the async state object so that the same binding can be used to free as was used to allocate.


Commit migrated from https://github.com/dotnet/corefx/commit/0f672042510d1902f7071189860c1960bd99ef43
2015-08-06 23:17:06 -04:00
stephentoub 1cc968c539 Add small timeout to FSW MOVED_FROM polling on Linux
inotify handles renames via a pair of MOVED_FROM and MOVED_TO events that are potentially delivered separately and that for some moves may not have a MOVED_TO at all (such as if moving a file out of the watched path). This means that if we get a MOVED_FROM and we haven't yet received any further events, we have a choice:
- Do we wait until we get another event to make a decision about how to process the MOVED_FROM, seeing if the next event is a MOVED_TO (in which case the MOVED_FROM is treated as part of the rename) or if it's something else (in which case the MOVED_FROM is treated as a deletion).
- Do we assume we won't get an associated MOVED_TO, and immediately treat the MOVED_FROM as a deletion.

We originally implemented the former, as it doesn't suffer from the race condition the latter suffers from, which might treat some MOVED_FROM/MOVED_TO pairs as a rename and others as a creation/deletion, based on timing. But it suffers from another problem, that if you just get a MOVED_FROM and no other event arrives (or arrives for a while) the event associated with the MOVED_FROM could be delayed (indefinitely if another event never arrives). dotnet/corefx#2587 switched from the former to the latter, under the assumption that it's the least bad of the two options.

As discussed at https://github.com/dotnet/corefx/pull/2655#issuecomment-128484923, a compromise can be to wait a few milliseconds for the MOVED_TO to arrive, as that's been shown to handle a vast majority of the cases where a MOVED_TO is on its way.  This commit simply adds that timeout to our call to poll.  As long as this code was being modified, the commit also adds a try/finally around the handle manipulation, just in case an exception happens to emerge.


Commit migrated from https://github.com/dotnet/corefx/commit/919d7af3f1277691c482bc0b7e35a510fe5fa370
2015-08-06 22:12:29 -04:00
Nick Guerrera 046e1595fa Fix FileSystemWatcher test race + wrong event name
On Linux, depending on the timing of events, we can sometimes generate
delete+create instead of rename. As such, we can't perform renames and
test that no create or delete is raised when we're running on Linux.

The issue had so far only arisen on the negative create test and not the
negative delete test, which turned out to be because the negative delete
test was using the wrong event name.


Commit migrated from https://github.com/dotnet/corefx/commit/56c279db8707bf9246109b1ff232925e0312b7f8
2015-08-06 12:55:23 -07:00
stephentoub d6467ac0af Use RuntimeInformation across corefx for platform detection
This commit deletes our temporary Interop.PlatformDetection.cs mechanism and replaces usage of it with usage of System.Runtime.InteropServices.RuntimeInformation.dll.


Commit migrated from https://github.com/dotnet/corefx/commit/6861b625b391566544be9a60356c8c03b15e5fb5
2015-08-06 10:25:17 -04:00
Nick Guerrera f6ce429b8e Respond to PR feeback
* Defer conversions until necessary
* Rename Errno -> RawErrno
* Return null for ERANGE for strerror
* Add conversion helper for Error -> ErrorInfo
* Fix typos
* Remove unnecessary _POSIX_C_SOURCE define
* Fix names and sizes of managed FileStatus members
* Don't double-initialize ErrorInfo out param
* Zero out BirthTime when not available
* Put back newline at EOL
* Restore size of UnixFileSystemObject
* Use ignored local name for ignored error info
* Rename Interop.System to Interop.Sys to avoid
  collision with System namespace


Commit migrated from https://github.com/dotnet/corefx/commit/e82401bd3feea682832215d1e97dbb4bb73e211a
2015-08-06 06:52:01 +00:00
Nick Guerrera ef4deeef20 Use new errno shim from managed code
Commit migrated from https://github.com/dotnet/corefx/commit/2b01345b2a925400569269b1149afd645c77b790
2015-08-06 06:52:01 +00:00
Nick Guerrera 2a937c7ad4 Cleanup stat shims
* Provide explicit constants for interpreting file mode
* Use extern "C" one function at a time
* Rename FileStats to FileStatus to match POSIX language
* Rename FileStatus to be more 1:1 with struct stat
* Put parameters on their own lines in header


Commit migrated from https://github.com/dotnet/corefx/commit/bf0290c0a45f9ea1edafaf1aa12f4ff576107303
2015-08-06 06:51:47 +00:00
Nick Guerrera 93c5dee547 Rename System.IO.Native to System.Native
Rationale: Moving forward, we'll use System.Native for anything that
is specified as part of POSIX.


Commit migrated from https://github.com/dotnet/corefx/commit/f09c8282407b8cc332db0593827524c49bdae4a2
2015-08-05 23:17:27 -07:00