Line 0
Link Here
|
|
|
1 |
diff --git lib/sanitizer_common/sanitizer_linux.cc lib/sanitizer_common/sanitizer_linux.cc |
2 |
index 7328a5c0ac1..4b59a39ee27 100644 |
3 |
--- lib/sanitizer_common/sanitizer_linux.cc |
4 |
+++ lib/sanitizer_common/sanitizer_linux.cc |
5 |
@@ -223,7 +223,8 @@ static void kernel_stat_to_stat(struct kernel_stat *in, struct stat *out) { |
6 |
|
7 |
uptr internal_stat(const char *path, void *buf) { |
8 |
#if SANITIZER_FREEBSD |
9 |
- return internal_syscall(SYSCALL(stat), path, buf); |
10 |
+ return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, |
11 |
+ (uptr)buf, 0); |
12 |
#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
13 |
return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, |
14 |
(uptr)buf, 0); |
15 |
@@ -247,7 +248,8 @@ uptr internal_stat(const char *path, void *buf) { |
16 |
|
17 |
uptr internal_lstat(const char *path, void *buf) { |
18 |
#if SANITIZER_FREEBSD |
19 |
- return internal_syscall(SYSCALL(lstat), path, buf); |
20 |
+ return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, |
21 |
+ (uptr)buf, AT_SYMLINK_NOFOLLOW); |
22 |
#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
23 |
return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, |
24 |
(uptr)buf, AT_SYMLINK_NOFOLLOW); |
25 |
@@ -590,7 +592,9 @@ uptr internal_getppid() { |
26 |
} |
27 |
|
28 |
uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) { |
29 |
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
30 |
+#if SANITIZER_FREEBSD |
31 |
+ return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL); |
32 |
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
33 |
return internal_syscall(SYSCALL(getdents64), fd, (uptr)dirp, count); |
34 |
#else |
35 |
return internal_syscall(SYSCALL(getdents), fd, (uptr)dirp, count); |
36 |
diff --git lib/sanitizer_common/sanitizer_platform_limits_posix.h lib/sanitizer_common/sanitizer_platform_limits_posix.h |
37 |
index 5cbd78d3c1b..d7ce7b501f7 100644 |
38 |
--- lib/sanitizer_common/sanitizer_platform_limits_posix.h |
39 |
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.h |
40 |
@@ -489,7 +489,8 @@ namespace __sanitizer { |
41 |
}; |
42 |
#elif SANITIZER_FREEBSD |
43 |
struct __sanitizer_dirent { |
44 |
- unsigned int d_fileno; |
45 |
+ unsigned long long d_fileno; |
46 |
+ unsigned long long d_off; |
47 |
unsigned short d_reclen; |
48 |
// more fields that we don't care about |
49 |
}; |