You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/04/10 02:32:46 UTC

mesos git commit: Windows: Implemented `os::close` for Windows.

Repository: mesos
Updated Branches:
  refs/heads/master 9a0829f4f -> 9503be289


Windows: Implemented `os::close` for Windows.

Review: https://reviews.apache.org/r/44142/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9503be28
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9503be28
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9503be28

Branch: refs/heads/master
Commit: 9503be28979c0be7f2bdb4a5916759018aa5382c
Parents: 9a0829f
Author: Daniel Pravat <dp...@outlook.com>
Authored: Sat Apr 9 17:03:49 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Sat Apr 9 17:03:49 2016 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/os/close.hpp   | 27 +++-----------
 .../stout/include/stout/os/posix/close.hpp      | 35 ++++++++++++++++++
 .../stout/include/stout/os/windows/close.hpp    | 37 ++++++++++++++++++++
 .../3rdparty/stout/include/stout/windows.hpp    | 13 -------
 4 files changed, 76 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9503be28/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 1c912c3..a1d7588 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/close.hpp
@@ -14,29 +14,10 @@
 #define __STOUT_OS_CLOSE_HPP__
 
 
-#ifndef __WINDOWS__
-#include <unistd.h>
+#ifdef __WINDOWS__
+#include <stout/os/windows/close.hpp>
+#else
+#include <stout/os/posix/close.hpp>
 #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/9503be28/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
new file mode 100644
index 0000000..695b232
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/close.hpp
@@ -0,0 +1,35 @@
+// 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/9503be28/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
new file mode 100644
index 0000000..8f7318a
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp
@@ -0,0 +1,37 @@
+// 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>
+
+#include <stout/os/socket.hpp>
+
+namespace os {
+
+inline Try<Nothing> close(int fd)
+{
+  if (net::is_socket(fd)) {
+    SOCKET s = fd;
+    ::closesocket(s);
+  } else {
+    ::_close(fd);
+  }
+
+  return Nothing();
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_CLOSE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/9503be28/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
index a7f855d..3828c53 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
@@ -339,19 +339,6 @@ decltype(_write(fd, buffer, count))
 }
 
 
-inline auto open(const char* path, int flags) ->
-decltype(_open(path, flags))
-{
-  return _open(path, flags);
-}
-
-
-inline auto close(int fd) ->
-decltype(_close(fd))
-{
-  return _close(fd);
-}
-
 
 inline auto chdir(const char* path) ->
 decltype(_chdir(path))