Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>.

Also fix <sys/ipc.h>.

Not useful except to systems/bringup folks for testing. Trivial tests
added, and double-checked under strace to see that things look right.

x86 -- which works differently to everything else -- tested on the host.

Bug: http://b/27952303
Change-Id: I328534e994ae9e90755f545478fba03038c0bb94
diff --git a/libc/kernel/uapi/linux/msg.h b/libc/kernel/uapi/linux/msg.h
index b455f0c..a15b499 100644
--- a/libc/kernel/uapi/linux/msg.h
+++ b/libc/kernel/uapi/linux/msg.h
@@ -26,8 +26,8 @@
 #define MSG_EXCEPT 020000
 #define MSG_COPY 040000
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct msqid_ds {
-  struct ipc_perm msg_perm;
+struct __kernel_legacy_msqid_ds {
+  struct __kernel_legacy_ipc_perm msg_perm;
   struct msg * msg_first;
   struct msg * msg_last;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */