[compiler-rt] [compiler-rt] adding preadv2/pwritev2 interceptions. (PR #97216)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 30 07:34:23 PDT 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 6699807fa7397b1ba5c2c148d04d88afd3309226 42cc6e795a99ee87946741a9087b947c4499f68f -- compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.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 eae0e8ebba..bac4fd82d5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -10266,13 +10266,15 @@ INTERCEPTOR(SSIZE_T, preadv2, int fd, __sanitizer_iovec *iov, int iovcnt,
   COMMON_INTERCEPTOR_ENTER(ctx, preadv2, fd, iov, iovcnt, offset, flags);
   COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
   SSIZE_T res = REAL(preadv2)(fd, iov, iovcnt, offset, flags);
-  if (res > 0) write_iovec(ctx, iov, iovcnt, res);
-  if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
+  if (res > 0)
+    write_iovec(ctx, iov, iovcnt, res);
+  if (res >= 0 && fd >= 0)
+    COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
   return res;
 }
-#define INIT_PREADV2 COMMON_INTERCEPT_FUNCTION(preadv2)
+#  define INIT_PREADV2 COMMON_INTERCEPT_FUNCTION(preadv2)
 #else
-#define INIT_PREADV2
+#  define INIT_PREADV2
 #endif
 
 #if SANITIZER_INTERCEPT_PWRITEV2
@@ -10281,14 +10283,16 @@ INTERCEPTOR(SSIZE_T, pwritev2, int fd, __sanitizer_iovec *iov, int iovcnt,
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, pwritev2, fd, iov, iovcnt, offset, flags);
   COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
-  if (fd >= 0) COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd);
+  if (fd >= 0)
+    COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd);
   SSIZE_T res = REAL(pwritev2)(fd, iov, iovcnt, offset, flags);
-  if (res > 0) read_iovec(ctx, iov, iovcnt, res);
+  if (res > 0)
+    read_iovec(ctx, iov, iovcnt, res);
   return res;
 }
-#define INIT_PWRITEV2 COMMON_INTERCEPT_FUNCTION(pwritev2)
+#  define INIT_PWRITEV2 COMMON_INTERCEPT_FUNCTION(pwritev2)
 #else
-#define INIT_PWRITEV2
+#  define INIT_PWRITEV2
 #endif
 
 #include "sanitizer_common_interceptors_netbsd_compat.inc"

``````````

</details>


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


More information about the llvm-commits mailing list