| @@ -287,27 +287,31 @@ uptr internal_lstat(const char *path, vo | | | @@ -287,27 +287,31 @@ uptr internal_lstat(const char *path, vo |
287 | return res; | | 287 | return res; |
288 | # else | | 288 | # else |
289 | return internal_syscall(SYSCALL(lstat), (uptr)path, (uptr)buf); | | 289 | return internal_syscall(SYSCALL(lstat), (uptr)path, (uptr)buf); |
290 | # endif | | 290 | # endif |
291 | #else | | 291 | #else |
292 | struct stat64 buf64; | | 292 | struct stat64 buf64; |
293 | int res = internal_syscall(SYSCALL(lstat64), path, &buf64); | | 293 | int res = internal_syscall(SYSCALL(lstat64), path, &buf64); |
294 | stat64_to_stat(&buf64, (struct stat *)buf); | | 294 | stat64_to_stat(&buf64, (struct stat *)buf); |
295 | return res; | | 295 | return res; |
296 | #endif | | 296 | #endif |
297 | } | | 297 | } |
298 | | | 298 | |
299 | uptr internal_fstat(fd_t fd, void *buf) { | | 299 | uptr internal_fstat(fd_t fd, void *buf) { |
300 | #if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS | | 300 | #if SANITIZER_FREEBSD || SANITIZER_NETBSD |
| | | 301 | return internal_syscall(SYSCALL(fstat), fd, (uptr)buf); |
| | | 302 | #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
| | | 303 | return = internal_syscall(SYSCALL(fstat), fd, &kbuf); |
| | | 304 | #elif SANITIZER_LINUX_USES_64BIT_SYSCALLS |
301 | # if SANITIZER_MIPS64 | | 305 | # if SANITIZER_MIPS64 |
302 | // For mips64, fstat syscall fills buffer in the format of kernel_stat | | 306 | // For mips64, fstat syscall fills buffer in the format of kernel_stat |
303 | struct kernel_stat kbuf; | | 307 | struct kernel_stat kbuf; |
304 | int res = internal_syscall(SYSCALL(fstat), fd, &kbuf); | | 308 | int res = internal_syscall(SYSCALL(fstat), fd, &kbuf); |
305 | kernel_stat_to_stat(&kbuf, (struct stat *)buf); | | 309 | kernel_stat_to_stat(&kbuf, (struct stat *)buf); |
306 | return res; | | 310 | return res; |
307 | # else | | 311 | # else |
308 | return internal_syscall(SYSCALL(fstat), fd, (uptr)buf); | | 312 | return internal_syscall(SYSCALL(fstat), fd, (uptr)buf); |
309 | # endif | | 313 | # endif |
310 | #else | | 314 | #else |
311 | struct stat64 buf64; | | 315 | struct stat64 buf64; |
312 | int res = internal_syscall(SYSCALL(fstat64), fd, &buf64); | | 316 | int res = internal_syscall(SYSCALL(fstat64), fd, &buf64); |
313 | stat64_to_stat(&buf64, (struct stat *)buf); | | 317 | stat64_to_stat(&buf64, (struct stat *)buf); |