@@ -46,6 +46,9 @@ void OSSpinLockLock(volatile OSSpinLock *__lock);
46
46
#include < pthread.h>
47
47
#include < stdarg.h>
48
48
#include < stdio.h>
49
+ #if SANITIZER_LINUX
50
+ #include < sys/inotify.h>
51
+ #endif
49
52
#include < sys/select.h>
50
53
#include < sys/socket.h>
51
54
#include < sys/stat.h>
@@ -1174,6 +1177,39 @@ INTERCEPTOR(int, kevent64, int kq, const struct kevent64_s *changelist,
1174
1177
#define RTSAN_MAYBE_INTERCEPT_KEVENT64
1175
1178
#endif // SANITIZER_INTERCEPT_KQUEUE
1176
1179
1180
+ #if SANITIZER_LINUX
1181
+ INTERCEPTOR (int , inotify_init) {
1182
+ __rtsan_notify_intercepted_call (" inotify_init" );
1183
+ return REAL (inotify_init)();
1184
+ }
1185
+
1186
+ INTERCEPTOR (int , inotify_init1, int flags) {
1187
+ __rtsan_notify_intercepted_call (" inotify_init1" );
1188
+ return REAL (inotify_init1)(flags);
1189
+ }
1190
+
1191
+ INTERCEPTOR (int , inotify_add_watch, int fd, const char *path, uint32_t mask) {
1192
+ __rtsan_notify_intercepted_call (" inotify_add_watch" );
1193
+ return REAL (inotify_add_watch)(fd, path, mask);
1194
+ }
1195
+
1196
+ INTERCEPTOR (int , inotify_rm_watch, int fd, int wd) {
1197
+ __rtsan_notify_intercepted_call (" inotify_rm_watch" );
1198
+ return REAL (inotify_rm_watch)(fd, wd);
1199
+ }
1200
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT INTERCEPT_FUNCTION (inotify_init)
1201
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1 INTERCEPT_FUNCTION (inotify_init1)
1202
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH \
1203
+ INTERCEPT_FUNCTION (inotify_add_watch)
1204
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH \
1205
+ INTERCEPT_FUNCTION (inotify_rm_watch)
1206
+ #else
1207
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT
1208
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1
1209
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH
1210
+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH
1211
+ #endif
1212
+
1177
1213
INTERCEPTOR (int , pipe, int pipefd[2 ]) {
1178
1214
__rtsan_notify_intercepted_call (" pipe" );
1179
1215
return REAL (pipe)(pipefd);
@@ -1415,6 +1451,11 @@ void __rtsan::InitializeInterceptors() {
1415
1451
RTSAN_MAYBE_INTERCEPT_KEVENT;
1416
1452
RTSAN_MAYBE_INTERCEPT_KEVENT64;
1417
1453
1454
+ RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT;
1455
+ RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1;
1456
+ RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH;
1457
+ RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH;
1458
+
1418
1459
INTERCEPT_FUNCTION (pipe);
1419
1460
INTERCEPT_FUNCTION (mkfifo);
1420
1461
0 commit comments