Commit 96c61174 by Edward Thomson

cmake: only use `getloadavg` where it exists

parent 3809ab0e
...@@ -71,6 +71,7 @@ check_function_exists(qsort_s GIT_QSORT_S) ...@@ -71,6 +71,7 @@ check_function_exists(qsort_s GIT_QSORT_S)
# random / entropy data # random / entropy data
check_function_exists(getentropy GIT_RAND_GETENTROPY) check_function_exists(getentropy GIT_RAND_GETENTROPY)
check_function_exists(getloadavg GIT_RAND_GETLOADAVG)
# determine architecture of the machine # determine architecture of the machine
......
...@@ -57,5 +57,6 @@ ...@@ -57,5 +57,6 @@
#cmakedefine GIT_SHA256_MBEDTLS 1 #cmakedefine GIT_SHA256_MBEDTLS 1
#cmakedefine GIT_RAND_GETENTROPY 1 #cmakedefine GIT_RAND_GETENTROPY 1
#cmakedefine GIT_RAND_GETLOADAVG 1
#endif #endif
...@@ -106,8 +106,6 @@ GIT_INLINE(int) getseed(uint64_t *seed) ...@@ -106,8 +106,6 @@ GIT_INLINE(int) getseed(uint64_t *seed)
return -1; return -1;
} }
getloadavg(loadavg, 3);
*seed = 0; *seed = 0;
*seed |= ((uint64_t)tv.tv_usec << 40); *seed |= ((uint64_t)tv.tv_usec << 40);
*seed |= ((uint64_t)tv.tv_sec); *seed |= ((uint64_t)tv.tv_sec);
...@@ -119,9 +117,15 @@ GIT_INLINE(int) getseed(uint64_t *seed) ...@@ -119,9 +117,15 @@ GIT_INLINE(int) getseed(uint64_t *seed)
*seed ^= ((uint64_t)getuid() << 8); *seed ^= ((uint64_t)getuid() << 8);
*seed ^= ((uint64_t)getgid()); *seed ^= ((uint64_t)getgid());
# if defined(GIT_RAND_GETLOADAVG)
getloadavg(loadavg, 3);
convert.f = loadavg[0]; *seed ^= (convert.d >> 36); convert.f = loadavg[0]; *seed ^= (convert.d >> 36);
convert.f = loadavg[1]; *seed ^= (convert.d); convert.f = loadavg[1]; *seed ^= (convert.d);
convert.f = loadavg[2]; *seed ^= (convert.d >> 16); convert.f = loadavg[2]; *seed ^= (convert.d >> 16);
# else
GIT_UNUSED(loadavg[0]);
# endif
convert.f = git__timer(); *seed ^= (convert.d); convert.f = git__timer(); *seed ^= (convert.d);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment