-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>.
+ */
+#ifndef _UID_T
+typedef __darwin_uid_t uid_t; /* user id */
+#define _UID_T
+#endif
+
+#ifndef _GID_T
+typedef __darwin_gid_t gid_t;
+#define _GID_T
+#endif
+
+#ifndef _MODE_T
+typedef __darwin_mode_t mode_t;
+#define _MODE_T
+#endif
+
+#ifndef _KEY_T
+#define _KEY_T
+typedef __int32_t key_t;
+#endif
+
+#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 */