@@ -10259,6 +10259,38 @@ INTERCEPTOR(int, cpuset_getaffinity, int level, int which, __int64_t id, SIZE_T
10259
10259
#define INIT_CPUSET_GETAFFINITY
10260
10260
#endif
10261
10261
10262
+ #if SANITIZER_INTERCEPT_PREADV2
10263
+ INTERCEPTOR (SSIZE_T, preadv2, int fd, __sanitizer_iovec *iov, int iovcnt,
10264
+ OFF_T offset, int flags) {
10265
+ void *ctx;
10266
+ COMMON_INTERCEPTOR_ENTER (ctx, preadv2, fd, iov, iovcnt, offset, flags);
10267
+ COMMON_INTERCEPTOR_FD_ACCESS (ctx, fd);
10268
+ SSIZE_T res = REAL (preadv2)(fd, iov, iovcnt, offset, flags);
10269
+ if (res > 0 ) write_iovec (ctx, iov, iovcnt, res);
10270
+ if (res >= 0 && fd >= 0 ) COMMON_INTERCEPTOR_FD_ACQUIRE (ctx, fd);
10271
+ return res;
10272
+ }
10273
+ #define INIT_PREADV2 COMMON_INTERCEPT_FUNCTION (preadv2)
10274
+ #else
10275
+ #define INIT_PREADV2
10276
+ #endif
10277
+
10278
+ #if SANITIZER_INTERCEPT_PWRITEV2
10279
+ INTERCEPTOR (SSIZE_T, pwritev2, int fd, __sanitizer_iovec *iov, int iovcnt,
10280
+ OFF_T offset, int flags) {
10281
+ void *ctx;
10282
+ COMMON_INTERCEPTOR_ENTER (ctx, pwritev2, fd, iov, iovcnt, offset, flags);
10283
+ COMMON_INTERCEPTOR_FD_ACCESS (ctx, fd);
10284
+ if (fd >= 0 ) COMMON_INTERCEPTOR_FD_RELEASE (ctx, fd);
10285
+ SSIZE_T res = REAL (pwritev2)(fd, iov, iovcnt, offset, flags);
10286
+ if (res > 0 ) read_iovec (ctx, iov, iovcnt, res);
10287
+ return res;
10288
+ }
10289
+ #define INIT_PWRITEV2 COMMON_INTERCEPT_FUNCTION (pwritev2)
10290
+ #else
10291
+ #define INIT_PWRITEV2
10292
+ #endif
10293
+
10262
10294
#include " sanitizer_common_interceptors_netbsd_compat.inc"
10263
10295
10264
10296
namespace __sanitizer {
@@ -10578,6 +10610,8 @@ static void InitializeCommonInterceptors() {
10578
10610
INIT___XUNAME;
10579
10611
INIT_ARGP_PARSE;
10580
10612
INIT_CPUSET_GETAFFINITY;
10613
+ INIT_PREADV2;
10614
+ INIT_PWRITEV2;
10581
10615
10582
10616
INIT___PRINTF_CHK;
10583
10617
}
0 commit comments