[Mac] Fix ProcessUtilTest.FDRemapping for 10.9 and later.

OSX 10.9 introduced a kernel facility which allows tagging file
descriptors to prevent various operations unless the caller knows the
key.  libdispatch uses this facility to tag a file descriptor against
close() or dup(), and this test does both.  Unfortunately, the failure
case is to raise a kernel exception and hang the child process rather
than return an error code.

This change addresses this by attempting to set a guard.  If successful,
the guard is removed and the caller can close the file descriptor as
normal.  If unsuccessful, either the file descriptor is not valid, or it
is guarded and cannot be closed.  Either way, it is skipped.  The test
still succeeds by counting the file descriptors which can be closed.

BUG=338157

Review URL: https://codereview.chromium.org/414503005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286037 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 6111004802718e6566262f82699d0ab0ed4e53f3
1 file changed
tree: 1e443ebc8a959af95439f939d452a48f4a1e366e
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/