You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2016/01/20 23:52:54 UTC

[1/4] mesos git commit: FreeBSD: Fix includes in stout.

Repository: mesos
Updated Branches:
  refs/heads/master 894dbb21f -> 037e0f83e


FreeBSD: Fix includes in stout.

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


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

Branch: refs/heads/master
Commit: 8f0142391bb71ef088309c6b9a157bcb06bd5eaf
Parents: 894dbb2
Author: David Forsythe <df...@gmail.com>
Authored: Wed Jan 20 14:48:30 2016 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Wed Jan 20 14:52:45 2016 -0800

----------------------------------------------------------------------
 .../libprocess/3rdparty/stout/include/stout/os/freebsd.hpp     | 6 ++----
 3rdparty/libprocess/3rdparty/stout/include/stout/os/sysctl.hpp | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8f014239/3rdparty/libprocess/3rdparty/stout/include/stout/os/freebsd.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/freebsd.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/freebsd.hpp
index 269e35f..10346de 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/freebsd.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/freebsd.hpp
@@ -18,14 +18,12 @@
 #error "stout/os/freebsd.hpp is only available on FreeBSD systems."
 #endif
 
-#include <sys/sysctl.h>
 #include <sys/types.h>
-#ifdef __FreeBSD__
-#include <stout/os/freebsd.hpp>
-#endif
 #include <sys/user.h>
 #include <unistd.h>
 
+#include <stout/os/sysctl.hpp>
+
 namespace os {
 
 inline Result<Process> process(pid_t pid)

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f014239/3rdparty/libprocess/3rdparty/stout/include/stout/os/sysctl.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/sysctl.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/sysctl.hpp
index 8cfc77f..bb78bb6 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/sysctl.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/sysctl.hpp
@@ -13,7 +13,7 @@
 #ifndef __STOUT_OS_SYSCTL_HPP__
 #define __STOUT_OS_SYSCTL_HPP__
 
-// Only provide sysctl support for OS X.
+// Only provide sysctl support for OS X and FreeBSD.
 #if !defined(__APPLE__) && !defined(__FreeBSD__)
 #error "stout/os/sysctl.hpp is only available on OS X and FreeBSD."
 #endif


[2/4] mesos git commit: FreeBSD: use BSD cp in copy provisioner backend.

Posted by id...@apache.org.
FreeBSD: use BSD cp in copy provisioner backend.

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


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

Branch: refs/heads/master
Commit: d89da4f654f8c8a89c260905f124f85d05ca507c
Parents: 8f01423
Author: David Forsythe <df...@gmail.com>
Authored: Wed Jan 20 14:49:05 2016 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Wed Jan 20 14:52:46 2016 -0800

----------------------------------------------------------------------
 src/slave/containerizer/mesos/provisioner/backends/copy.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d89da4f6/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/backends/copy.cpp b/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
index 86bbe71..f353c89 100644
--- a/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
+++ b/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
@@ -127,17 +127,17 @@ Future<Nothing> CopyBackendProcess::_provision(
   VLOG(1) << "Copying layer path '" << layer << "' to rootfs '" << rootfs
           << "'";
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
   if (!strings::endsWith(layer, "/")) {
     layer += "/";
   }
 
-  // OSX cp doesn't support -T flag, but supports source trailing
+  // BSD cp doesn't support -T flag, but supports source trailing
   // slash so we only copy the content but not the folder.
   vector<string> args{"cp", "-a", layer, rootfs};
 #else
   vector<string> args{"cp", "-aT", layer, rootfs};
-#endif // __APPLE__
+#endif // __APPLE__ || __FreeBSD__
 
   Try<Subprocess> s = subprocess(
       "cp",


[3/4] mesos git commit: Re-enable HTTPConnectionTest.ClosingRequest on FreeBSD.

Posted by id...@apache.org.
Re-enable HTTPConnectionTest.ClosingRequest on FreeBSD.

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


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

Branch: refs/heads/master
Commit: 037e0f83e711cac9268f8d8ff64d35f35d1db477
Parents: 451bdcb
Author: David Forsythe <df...@gmail.com>
Authored: Wed Jan 20 14:50:03 2016 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Wed Jan 20 14:52:46 2016 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/http_tests.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/037e0f83/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index 5a66d84..66d185e 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -857,12 +857,8 @@ TEST(HTTPConnectionTest, ClosingRequest)
   AWAIT_READY(connection.disconnected());
 }
 
-// TODO(dforsyth): The test suite doesn't see the second call on FreeBSD
-#ifndef __FreeBSD__
+
 TEST(HTTPConnectionTest, ClosingResponse)
-#else
-TEST(HTTPConnectionTest, DISABLED_ClosingResponse)
-#endif
 {
   Http http;
 


[4/4] mesos git commit: Implement os::memory() for FreeBSD.

Posted by id...@apache.org.
Implement os::memory() for FreeBSD.

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


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

Branch: refs/heads/master
Commit: 451bdcb714aebe8bc680bc7068aeee580ee61a04
Parents: d89da4f
Author: David Forsythe <df...@gmail.com>
Authored: Wed Jan 20 14:49:42 2016 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Wed Jan 20 14:52:46 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/posix/os.hpp   | 57 +++++++++++++++++++-
 1 file changed, 55 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/451bdcb7/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
index c2b9e3d..74af007 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
@@ -80,9 +80,9 @@
 #ifdef __sun
 #include <stout/os/sunos.hpp>
 #endif // __sun
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
 #include <stout/os/sysctl.hpp>
-#endif // __APPLE__
+#endif // __APPLE__ || __FreeBSD__
 
 #include <stout/os/raw/environment.hpp>
 
@@ -503,6 +503,8 @@ inline Try<Memory> memory()
 {
   Memory memory;
 
+// TODO(dforsyth): Refactor these implementations into seperate, platform
+// specific files.
 #ifdef __linux__
   struct sysinfo info;
   if (sysinfo(&info) != 0) {
@@ -566,6 +568,57 @@ inline Try<Memory> memory()
 
   return memory;
 
+#elif defined __FreeBSD__
+  const Try<int64_t> physicalMemory = os::sysctl(CTL_HW, HW_PHYSMEM).integer();
+  if (physicalMemory.isError()) {
+    return Error(physicalMemory.error());
+  }
+  memory.total = Bytes(physicalMemory.get());
+
+  const int pageSize = getpagesize();
+
+  unsigned int freeCount;
+  size_t length = sizeof(freeCount);
+
+  if (sysctlbyname(
+      "vm.stats.v_free_count",
+      &freeCount,
+      &length,
+      NULL,
+      0) != 0) {
+    return ErrnoError();
+  }
+  memory.free = Bytes(freeCount * pageSize);
+
+  int totalBlocks = 0;
+  int usedBlocks = 0;
+
+  int mib[3];
+  size_t mibSize = 2;
+  if (::sysctlnametomib("vm.swap_info", mib, &mibSize) != 0) {
+      return ErrnoError();
+  }
+
+  // FreeBSD supports multiple swap devices. Here we sum across all of them.
+  struct xswdev xswd;
+  size_t xswdSize = sizeof(xswd);
+  int* mibDevice = &(mib[mibSize + 1]);
+  for (*mibDevice = 0; ; (*mibDevice)++) {
+      if (::sysctl(mib, 3, &xswd, &xswdSize, NULL, 0) != 0) {
+          if (errno == ENOENT) {
+              break;
+          }
+          return ErrnoError();
+      }
+
+      totalBlocks += xswd.xsw_nblks;
+      usedBlocks += xswd.xsw_used;
+  }
+
+  memory.totalSwap = Bytes(totalBlocks * pageSize);
+  memory.freeSwap = Bytes((totalBlocks - usedBlocks) * pageSize);
+
+  return memory;
 #else
   return Error("Cannot determine the size of total and free memory");
 #endif