[compiler-rt] [compiler-rt] sched_getaffinity mask definition for Linux. (PR #79903)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 13:36:34 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 e633807a1fccbed91dbfe1fdc2c78adcaf21d99c 4365891cd134b0c7a771c81c944b8faaab64c419 -- compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
``````````

</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 9d556ff73d..3c8bf8c720 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -3870,7 +3870,8 @@ INTERCEPTOR(SIZE_T, confstr, int name, char *buf, SIZE_T len) {
 #endif
 
 #if SANITIZER_INTERCEPT_SCHED_GETAFFINITY
-INTERCEPTOR(int, sched_getaffinity, int pid, SIZE_T cpusetsize, __sanitizer_cpu_set_t *mask) {
+INTERCEPTOR(int, sched_getaffinity, int pid, SIZE_T cpusetsize,
+            __sanitizer_cpu_set_t *mask) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, sched_getaffinity, pid, cpusetsize, mask);
   // FIXME: under ASan the call below may write to freed memory and corrupt
@@ -3880,7 +3881,7 @@ INTERCEPTOR(int, sched_getaffinity, int pid, SIZE_T cpusetsize, __sanitizer_cpu_
   if (mask && !res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, mask, cpusetsize);
   return res;
 }
-#define INIT_SCHED_GETAFFINITY COMMON_INTERCEPT_FUNCTION(sched_getaffinity);
+#  define INIT_SCHED_GETAFFINITY COMMON_INTERCEPT_FUNCTION(sched_getaffinity);
 #else
 #define INIT_SCHED_GETAFFINITY
 #endif
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index 22449a0c31..88b4c0c95d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -85,9 +85,9 @@
 #include <linux/utsname.h>
 #include <linux/posix_types.h>
 #include <net/if_arp.h>
-#if !SANITIZER_ANDROID
-#include <sched.h>
-#endif
+#    if !SANITIZER_ANDROID
+#      include <sched.h>
+#    endif
 #endif
 
 #if SANITIZER_IOS
@@ -305,7 +305,7 @@ namespace __sanitizer {
   unsigned struct_mq_attr_sz = sizeof(struct mq_attr);
   unsigned struct_statvfs_sz = sizeof(struct statvfs);
   unsigned struct_cpu_set_sz = sizeof(cpu_set_t);
-#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
+#  endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
 
   const uptr sig_ign = (uptr)SIG_IGN;
   const uptr sig_dfl = (uptr)SIG_DFL;
@@ -1355,8 +1355,8 @@ CHECK_TYPE_SIZE(sem_t);
 COMPILER_CHECK(ARM_VFPREGS_SIZE == ARM_VFPREGS_SIZE_ASAN);
 #endif
 
-#if SANITIZER_LINUX && !SANITIZER_ANDROID
+#  if SANITIZER_LINUX && !SANITIZER_ANDROID
 COMPILER_CHECK(sizeof(__sanitizer_cpu_set_t) == sizeof(cpu_set_t));
-#endif
+#  endif
 
 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_APPLE

``````````

</details>


https://github.com/llvm/llvm-project/pull/79903


More information about the llvm-commits mailing list