[PATCH] [Sanitizers] Fix internal_lseek() to work on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Wed Jan 7 04:05:55 PST 2015


Comment fixed. Thanks Ed.


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
@@ -85,8 +85,9 @@
 // WARNING: OFF_T may be different from OS type off_t, depending on the value of
 // _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__))
+// FreeBSD, Mac and Linux/x86-64 are special.
+#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.17851.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150107/e1314076/attachment.bin>


More information about the llvm-commits mailing list