Make `union semun` usable.

This is a bit bogus because it's been removed from glibc (though not
thoroughly) and is never useful on Android (because the system calls
in question are compiled out of Android kernels, and SELinux would
disallow them even if you weren't running an Android kernel). This
also means that on glibc you need to include <linux/sem.h> for this
and on bionic you need <sys/sem.h> (and for either if you #include
the other file, you won't get this union).

Bug: https://github.com/android-ndk/ndk/issues/400
Test: added new test
Change-Id: I47f721da77515531f616d6ad8479bfbc9b60ee47
diff --git a/tests/sys_sem_test.cpp b/tests/sys_sem_test.cpp
index d8d83c5..eaf2b8f 100644
--- a/tests/sys_sem_test.cpp
+++ b/tests/sys_sem_test.cpp
@@ -98,3 +98,19 @@
   ASSERT_EQ(-1, semtimedop(-1, nullptr, 0, nullptr));
   ASSERT_TRUE(errno == EINVAL || errno == ENOSYS);
 }
+
+TEST(sys_sem, union_semun) {
+  // https://github.com/android-ndk/ndk/issues/400
+#if defined(__BIONIC__)
+  semun arg;
+  semid_ds i1;
+  seminfo i2;
+  unsigned short a[] = { 1u, 2u };
+  arg.val = 123;
+  arg.buf = &i1;
+  arg.array = a;
+  arg.__buf = &i2;
+#else
+  // glibc already mostly removed this cruft (although it's still in <linux/sem.h>).
+#endif
+}