You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/08/03 22:51:07 UTC

[2/2] mesos git commit: Updated logrotation module to use `os::pagesize()`.

Updated logrotation module to use `os::pagesize()`.

This gets us closer to compiling on Windows.

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


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

Branch: refs/heads/master
Commit: f538c4bc2b5786875c3eca776234e554dcfb08d6
Parents: df1e231
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Wed Aug 3 18:21:19 2016 -0400
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Wed Aug 3 18:22:21 2016 -0400

----------------------------------------------------------------------
 src/slave/container_loggers/lib_logrotate.hpp | 5 +++--
 src/slave/container_loggers/logrotate.cpp     | 3 ++-
 src/slave/container_loggers/logrotate.hpp     | 6 ++++--
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f538c4bc/src/slave/container_loggers/lib_logrotate.hpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.hpp b/src/slave/container_loggers/lib_logrotate.hpp
index 193b3ff..6fe38d1 100644
--- a/src/slave/container_loggers/lib_logrotate.hpp
+++ b/src/slave/container_loggers/lib_logrotate.hpp
@@ -26,6 +26,7 @@
 #include <stout/option.hpp>
 
 #include <stout/os/exists.hpp>
+#include <stout/os/pagesize.hpp>
 #include <stout/os/shell.hpp>
 
 #include "slave/container_loggers/logrotate.hpp"
@@ -131,10 +132,10 @@ struct Flags : public virtual flags::FlagsBase
 
   static Option<Error> validateSize(const Bytes& value)
   {
-    if (value.bytes() < (size_t) sysconf(_SC_PAGE_SIZE)) {
+    if (value.bytes() < os::pagesize()) {
       return Error(
           "Expected --max_stdout_size and --max_stderr_size of "
-          "at least " + stringify(sysconf(_SC_PAGE_SIZE)) + " bytes");
+          "at least " + stringify(os::pagesize()) + " bytes");
     }
 
     return None();

http://git-wip-us.apache.org/repos/asf/mesos/blob/f538c4bc/src/slave/container_loggers/logrotate.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/logrotate.cpp b/src/slave/container_loggers/logrotate.cpp
index a96cbf1..431bc3c 100644
--- a/src/slave/container_loggers/logrotate.cpp
+++ b/src/slave/container_loggers/logrotate.cpp
@@ -35,6 +35,7 @@
 #include <stout/stringify.hpp>
 #include <stout/try.hpp>
 
+#include <stout/os/pagesize.hpp>
 #include <stout/os/shell.hpp>
 #include <stout/os/write.hpp>
 
@@ -55,7 +56,7 @@ public:
       bytesWritten(0)
   {
     // Prepare a buffer for reading from the `incoming` pipe.
-    length = sysconf(_SC_PAGE_SIZE);
+    length = os::pagesize();
     buffer = new char[length];
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f538c4bc/src/slave/container_loggers/logrotate.hpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/logrotate.hpp b/src/slave/container_loggers/logrotate.hpp
index 16d9232..f906a16 100644
--- a/src/slave/container_loggers/logrotate.hpp
+++ b/src/slave/container_loggers/logrotate.hpp
@@ -26,6 +26,8 @@
 #include <stout/option.hpp>
 #include <stout/path.hpp>
 
+#include <stout/os/pagesize.hpp>
+
 
 namespace mesos {
 namespace internal {
@@ -55,10 +57,10 @@ struct Flags : public virtual flags::FlagsBase
         "Defaults to 10 MB.  Must be at least 1 (memory) page.",
         Megabytes(10),
         [](const Bytes& value) -> Option<Error> {
-          if (value.bytes() < (size_t) sysconf(_SC_PAGE_SIZE)) {
+          if (value.bytes() < os::pagesize()) {
             return Error(
                 "Expected --max_size of at least " +
-                stringify(sysconf(_SC_PAGE_SIZE)) + " bytes");
+                stringify(os::pagesize()) + " bytes");
           }
           return None();
         });