[PATCH] [Msan] Fix the shmctl unit tests to pass on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Thu Jan 29 07:43:46 PST 2015
Hi kcc, samsonov, eugenis, emaste,
http://reviews.llvm.org/D7253
Files:
lib/msan/tests/msan_test.cc
Index: lib/msan/tests/msan_test.cc
===================================================================
--- lib/msan/tests/msan_test.cc
+++ lib/msan/tests/msan_test.cc
@@ -21,6 +21,19 @@
#include "sanitizer/allocator_interface.h"
#include "sanitizer/msan_interface.h"
+#if defined(__FreeBSD__)
+# define _KERNEL // To declare 'shminfo' structure.
+# include <sys/shm.h>
+# undef _KERNEL
+extern "C" {
+// <sys/shm.h> doesn't declare these functions in _KERNEL mode.
+void *shmat(int, const void *, int);
+int shmget(key_t, size_t, int);
+int shmctl(int, int, struct shmid_ds *);
+int shmdt(const void *);
+}
+#endif
+
#include <inttypes.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -1165,6 +1178,8 @@
ASSERT_GT(res, -1);
EXPECT_NOT_POISONED(ds);
+ // FreeBSD does not support shmctl(IPC_INFO) and shmctl(SHM_INFO).
+#if !defined(__FreeBSD__)
struct shminfo si;
res = shmctl(id, IPC_INFO, (struct shmid_ds *)&si);
ASSERT_GT(res, -1);
@@ -1174,6 +1189,7 @@
res = shmctl(id, SHM_INFO, (struct shmid_ds *)&s_i);
ASSERT_GT(res, -1);
EXPECT_NOT_POISONED(s_i);
+#endif
res = shmctl(id, IPC_RMID, 0);
ASSERT_GT(res, -1);
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7253.18962.patch
Type: text/x-patch
Size: 1156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150129/c51168cf/attachment.bin>
More information about the llvm-commits
mailing list