Windows: Deleted dead code from `process::internal` namespace. The deleted code was purely self-referential.
Review: https://reviews.apache.org/r/66429 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/37e28446 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/37e28446 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/37e28446 Branch: refs/heads/master Commit: 37e284461345c9a014cf3f38ab01b6334e89d910 Parents: 99d53e4 Author: Andrew Schwartzmeyer <[email protected]> Authored: Mon Jan 22 16:03:50 2018 -0800 Committer: Andrew Schwartzmeyer <[email protected]> Committed: Tue May 1 18:36:04 2018 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/src/subprocess_windows.cpp | 66 --------------------- 1 file changed, 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/37e28446/3rdparty/libprocess/src/subprocess_windows.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/subprocess_windows.cpp b/3rdparty/libprocess/src/subprocess_windows.cpp index 1a91fbe..dc750c5 100644 --- a/3rdparty/libprocess/src/subprocess_windows.cpp +++ b/3rdparty/libprocess/src/subprocess_windows.cpp @@ -44,78 +44,12 @@ using OutputFileDescriptors = Subprocess::IO::OutputFileDescriptors; namespace internal { -static Try<HANDLE> duplicateHandle(const HANDLE handle) -{ - HANDLE duplicate = INVALID_HANDLE_VALUE; - - // TODO(anaparu): Do we need to scope the duplicated handle - // to the child process? - BOOL result = ::DuplicateHandle( - ::GetCurrentProcess(), // Source process == current. - handle, // Handle to duplicate. - ::GetCurrentProcess(), // Target process == current. - &duplicate, - 0, // Ignored (DUPLICATE_SAME_ACCESS). - TRUE, // Inheritable handle. - DUPLICATE_SAME_ACCESS); // Same access level as source. - - if (!result) { - return WindowsError("Failed to duplicate handle of stdin file"); - } - - return duplicate; -} - - -static Try<HANDLE> getHandleFromFileDescriptor(int_fd fd) -{ - // Extract handle from file descriptor. - const HANDLE handle = fd; - if (handle == INVALID_HANDLE_VALUE) { - return WindowsError("Failed to get `HANDLE` for file descriptor"); - } - - return handle; -} - - -static Try<HANDLE> getHandleFromFileDescriptor( - const int_fd fd, - const Subprocess::IO::FDType type) -{ - Try<HANDLE> handle = getHandleFromFileDescriptor(fd); - if (handle.isError()) { - return Error(handle.error()); - } - - switch (type) { - case Subprocess::IO::DUPLICATED: { - const Try<HANDLE> duplicate = duplicateHandle(handle.get()); - - if (duplicate.isError()) { - return Error(duplicate.error()); - } - - return duplicate; - } - case Subprocess::IO::OWNED: - return handle; - - // NOTE: By not setting a default we leverage the compiler - // errors when the enumeration is augmented to find all - // the cases we need to provide. Same for below. - } -} - - // Creates a file for a subprocess's stdin, stdout, or stderr. // // NOTE: For portability, Libprocess implements POSIX-style semantics for these // files, and make no assumptions about who has access to them. For example, we // do not enforce a process-level write lock on stdin, and we do not enforce a // similar read lock from stdout. -// -// TODO(hausdorff): Rethink name here, write a comment about this function. static Try<HANDLE> createIoPath(const string& path, DWORD accessFlags) { // Per function comment, the flags `FILE_SHARE_READ`, `FILE_SHARE_WRITE`, and
