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 +# undef _KERNEL +extern "C" { +// 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 #include #include @@ -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);