[compiler-rt] [compiler-rt] making getrandom call blocking. (PR #78340)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 12:07:28 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 8d7bba0d5a8f024f44995adb9f3286c00b316689 ddec1e4acf25c68f926af10e00e2390dcce7b511 -- compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 663a7e95f4..1fcb15be7f 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -9965,18 +9965,18 @@ INTERCEPTOR(void, sl_free, void *sl, int freeall) {
INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, getrandom, buf, buflen, flags);
-#if SANITIZER_LINUX
+# if SANITIZER_LINUX
// only on Linux GRND_NONBLOCK has an actual effect.
// in other platforms /dev/random == /dev/urandom
- static const int grnd_nonblock = 1;
+ static const int grnd_nonblock = 1;
SSIZE_T n;
if ((flags & grnd_nonblock))
n = REAL(getrandom)(buf, buflen, flags);
else
n = COMMON_INTERCEPTOR_BLOCK_REAL(getrandom)(buf, buflen, flags);
-#else
+# else
SSIZE_T n = COMMON_INTERCEPTOR_BLOCK_REAL(getrandom)(buf, buflen, flags);
-#endif
+# endif
if (n > 0) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, n);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/78340
More information about the llvm-commits
mailing list