Implemented os::close for Windows. Review: https://reviews.apache.org/r/37031
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/342f2b30 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/342f2b30 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/342f2b30 Branch: refs/heads/master Commit: 342f2b301ef42dee3077351db8debdc054e32848 Parents: 92ed652 Author: Alex Clemmer <[email protected]> Authored: Thu Sep 10 12:06:49 2015 -0700 Committer: Joris Van Remoortere <[email protected]> Committed: Thu Sep 10 17:14:54 2015 -0700 ---------------------------------------------------------------------- .../3rdparty/stout/include/Makefile.am | 2 -- .../3rdparty/stout/include/stout/os/close.hpp | 28 +++++++++++---- .../stout/include/stout/os/posix/close.hpp | 37 -------------------- .../stout/include/stout/os/windows/close.hpp | 31 ---------------- 4 files changed, 22 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/342f2b30/3rdparty/libprocess/3rdparty/stout/include/Makefile.am ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am index 8853f92..58844a2 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am +++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am @@ -59,7 +59,6 @@ nobase_include_HEADERS = \ stout/os/fork.hpp \ stout/os/killtree.hpp \ stout/os/linux.hpp \ - stout/os/posix/close.hpp \ stout/os/posix/exists.hpp \ stout/os/posix/fcntl.hpp \ stout/os/posix/fork.hpp \ @@ -88,7 +87,6 @@ nobase_include_HEADERS = \ stout/os/permissions.hpp \ stout/os/pstree.hpp \ stout/os/sysctl.hpp \ - stout/os/windows/close.hpp \ stout/os/windows/exists.hpp \ stout/os/windows/fcntl.hpp \ stout/os/windows/fork.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/342f2b30/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp index 972f833..b692596 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp +++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp @@ -15,13 +15,29 @@ #define __STOUT_OS_CLOSE_HPP__ -// For readability, we minimize the number of #ifdef blocks in the code by -// splitting platform specifc system calls into separate directories. -#ifdef __WINDOWS__ -#include <stout/os/windows/close.hpp> -#else -#include <stout/os/posix/close.hpp> +#ifndef __WINDOWS__ +#include <unistd.h> #endif // __WINDOWS__ +#include <stout/error.hpp> +#include <stout/nothing.hpp> +#include <stout/try.hpp> + + +namespace os { + + +inline Try<Nothing> close(int fd) +{ + if (::close(fd) != 0) { + return ErrnoError(); + } + + return Nothing(); +} + + +} // namespace os { + #endif // __STOUT_OS_CLOSE_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/342f2b30/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/close.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/close.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/close.hpp deleted file mode 100644 index d8679ca..0000000 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/close.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef __STOUT_OS_POSIX_CLOSE_HPP__ -#define __STOUT_OS_POSIX_CLOSE_HPP__ - -#include <unistd.h> - -#include <stout/error.hpp> -#include <stout/nothing.hpp> -#include <stout/try.hpp> - - -namespace os { - -inline Try<Nothing> close(int fd) -{ - if (::close(fd) != 0) { - return ErrnoError(); - } - - return Nothing(); -} - -} // namespace os { - -#endif // __STOUT_OS_POSIX_CLOSE_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/342f2b30/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp deleted file mode 100644 index 134a26b..0000000 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __STOUT_OS_WINDOWS_CLOSE_HPP__ -#define __STOUT_OS_WINDOWS_CLOSE_HPP__ - -#include <stout/nothing.hpp> -#include <stout/try.hpp> - - -namespace os { - -inline Try<Nothing> close(int fd) -{ - UNIMPLEMENTED; -} - -} // namespace os { - -#endif // __STOUT_OS_WINDOWS_CLOSE_HPP__
