Repository: kudu
Updated Branches:
  refs/heads/master d47ce5dc2 -> 6c90e5dae


[util] fixed env-test on OS X

Prior to the fix, in some cases the uninitialized portion of 64-bit
variable was non-zero and since the sysctlbyname("kern.maxfilesperproc")
call output just 4 bytes, the value of the captured system property
was wrong.  Calling setrlimit() with astronomical values
did not succeed, failing the env-test test.

Change-Id: Ic355912b98b3fa592481e2457147e23de98447ea
Reviewed-on: http://gerrit.cloudera.org:8080/5738
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <[email protected]>


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

Branch: refs/heads/master
Commit: 6c90e5dae76c7b4cabd5b3ea93528796a630f391
Parents: d47ce5d
Author: Alexey Serbin <[email protected]>
Authored: Wed Jan 18 18:37:46 2017 -0800
Committer: Adar Dembo <[email protected]>
Committed: Fri Jan 20 01:26:19 2017 +0000

----------------------------------------------------------------------
 src/kudu/util/env_posix.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6c90e5da/src/kudu/util/env_posix.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index 2a83fa8..3dff7d9 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -1292,9 +1292,11 @@ class PosixEnv : public Env {
     // rlim_max (this is consistent with Linux).
     // TLDR; OS X 10.11 is wack.
     if (l.rlim_max == RLIM_INFINITY) {
-      uint64_t limit;
+      uint32_t limit;
       size_t len = sizeof(limit);
       PCHECK(sysctlbyname("kern.maxfilesperproc", &limit, &len, nullptr, 0) == 
0);
+      // Make sure no uninitialized bits are present in the result.
+      DCHECK_EQ(sizeof(limit), len);
       l.rlim_max = limit;
     }
 #endif

Reply via email to