[PATCH] [Sanitizers] Fix internal_lseek() to work on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Fri Jan 2 04:28:18 PST 2015
Hi kcc, samsonov, eugenis, emaste,
off_t is 64-bit on FreeBSD in both i386 and x86-64 modes.
http://reviews.llvm.org/D6825
Files:
lib/sanitizer_common/sanitizer_internal_defs.h
lib/sanitizer_common/tests/sanitizer_libc_test.cc
Index: lib/sanitizer_common/sanitizer_internal_defs.h
===================================================================
--- lib/sanitizer_common/sanitizer_internal_defs.h
+++ lib/sanitizer_common/sanitizer_internal_defs.h
@@ -82,7 +82,8 @@
// _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
// like pread and mmap, as opposed to pread64 and mmap64.
// Mac and Linux/x86-64 are special.
-#if SANITIZER_MAC || (SANITIZER_LINUX && defined(__x86_64__))
+#if SANITIZER_FREEBSD || SANITIZER_MAC || \
+ (SANITIZER_LINUX && defined(__x86_64__))
typedef u64 OFF_T;
#else
typedef uptr OFF_T;
Index: lib/sanitizer_common/tests/sanitizer_libc_test.cc
===================================================================
--- lib/sanitizer_common/tests/sanitizer_libc_test.cc
+++ lib/sanitizer_common/tests/sanitizer_libc_test.cc
@@ -142,8 +142,11 @@
res = internal_ftruncate(fd, page_size * 2);
ASSERT_FALSE(internal_iserror(res));
- internal_lseek(fd, page_size, SEEK_SET);
- internal_write(fd, "AB", 2);
+ res = internal_lseek(fd, page_size, SEEK_SET);
+ ASSERT_FALSE(internal_iserror(res));
+
+ res = internal_write(fd, "AB", 2);
+ ASSERT_FALSE(internal_iserror(res));
char *p = (char *)MapWritableFileToMemory(nullptr, page_size, fd, page_size);
ASSERT_NE(nullptr, p);
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6825.17759.patch
Type: text/x-patch
Size: 1318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150102/43b8cb74/attachment.bin>
More information about the llvm-commits
mailing list