Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
96c61174
Commit
96c61174
authored
Jun 13, 2022
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: only use `getloadavg` where it exists
parent
3809ab0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
src/CMakeLists.txt
+1
-0
src/features.h.in
+1
-0
src/util/rand.c
+6
-2
No files found.
src/CMakeLists.txt
View file @
96c61174
...
...
@@ -71,6 +71,7 @@ check_function_exists(qsort_s GIT_QSORT_S)
# random / entropy data
check_function_exists
(
getentropy GIT_RAND_GETENTROPY
)
check_function_exists
(
getloadavg GIT_RAND_GETLOADAVG
)
# determine architecture of the machine
...
...
src/features.h.in
View file @
96c61174
...
...
@@ -57,5 +57,6 @@
#cmakedefine GIT_SHA256_MBEDTLS 1
#cmakedefine GIT_RAND_GETENTROPY 1
#cmakedefine GIT_RAND_GETLOADAVG 1
#endif
src/util/rand.c
View file @
96c61174
...
...
@@ -106,8 +106,6 @@ GIT_INLINE(int) getseed(uint64_t *seed)
return
-
1
;
}
getloadavg
(
loadavg
,
3
);
*
seed
=
0
;
*
seed
|=
((
uint64_t
)
tv
.
tv_usec
<<
40
);
*
seed
|=
((
uint64_t
)
tv
.
tv_sec
);
...
...
@@ -119,9 +117,15 @@ GIT_INLINE(int) getseed(uint64_t *seed)
*
seed
^=
((
uint64_t
)
getuid
()
<<
8
);
*
seed
^=
((
uint64_t
)
getgid
());
# if defined(GIT_RAND_GETLOADAVG)
getloadavg
(
loadavg
,
3
);
convert
.
f
=
loadavg
[
0
];
*
seed
^=
(
convert
.
d
>>
36
);
convert
.
f
=
loadavg
[
1
];
*
seed
^=
(
convert
.
d
);
convert
.
f
=
loadavg
[
2
];
*
seed
^=
(
convert
.
d
>>
16
);
# else
GIT_UNUSED
(
loadavg
[
0
]);
# endif
convert
.
f
=
git__timer
();
*
seed
^=
(
convert
.
d
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment