-struct ipc_perm {
- ushort cuid; /* creator user id */
- ushort cgid; /* creator group id */
- ushort uid; /* user id */
- ushort gid; /* group id */
- ushort mode; /* r/w permission */
- ushort seq; /* sequence # (to generate unique msg/sem/shm id) */
- key_t key; /* user specified msg/sem/shm key */
+#include <sys/appleapiopts.h>
+#include <sys/cdefs.h>
+
+#include <sys/_types.h>
+
+/*
+ * [XSI] The uid_t, gid_t, mode_t, and key_t types SHALL be defined as
+ * described in <sys/types.h>.
+ */
+#include <sys/_types/_uid_t.h>
+#include <sys/_types/_gid_t.h>
+#include <sys/_types/_mode_t.h>
+#include <sys/_types/_key_t.h>
+
+
+#pragma pack(4)
+
+/*
+ * Technically, we should force all code references to the new structure
+ * definition, not in just the standards conformance case, and leave the
+ * legacy interface there for binary compatibility only. Currently, we
+ * are only forcing this for programs requesting standards conformance.
+ */
+#if __DARWIN_UNIX03 || defined(KERNEL)
+/*
+ * [XSI] Information used in determining permission to perform an IPC
+ * operation
+ */
+struct ipc_perm
+{
+ uid_t uid; /* [XSI] Owner's user ID */
+ gid_t gid; /* [XSI] Owner's group ID */
+ uid_t cuid; /* [XSI] Creator's user ID */
+ gid_t cgid; /* [XSI] Creator's group ID */
+ mode_t mode; /* [XSI] Read/write permission */
+ unsigned short _seq; /* Reserved for internal use */
+ key_t _key; /* Reserved for internal use */
+};
+#define __ipc_perm_new ipc_perm
+#else /* !__DARWIN_UNIX03 */
+#define ipc_perm __ipc_perm_old
+#endif /* !__DARWIN_UNIX03 */
+
+#if !__DARWIN_UNIX03
+/*
+ * Legacy structure; this structure is maintained for binary backward
+ * compatability with previous versions of the interface. New code
+ * should not use this interface, since ID values may be truncated.
+ */
+struct __ipc_perm_old {
+ __uint16_t cuid; /* Creator's user ID */
+ __uint16_t cgid; /* Creator's group ID */
+ __uint16_t uid; /* Owner's user ID */
+ __uint16_t gid; /* Owner's group ID */
+ mode_t mode; /* Read/Write permission */
+ __uint16_t seq; /* Reserved for internal use */
+ key_t key; /* Reserved for internal use */