-struct sem_undo {
- struct sem_undo *un_next; /* ptr to next active undo structure */
- struct proc *un_proc; /* owner of this structure */
- short un_cnt; /* # of active entries */
- struct undo {
- short un_adjval; /* adjust on exit values */
- short un_num; /* semaphore # */
- int un_id; /* semid */
- } un_ent[SEMUME]; /* undo entries */
+#if __DARWIN_UNIX03 || defined(KERNEL)
+#pragma pack(4)
+/*
+ * Structure used internally.
+ *
+ * This structure is exposed because standards dictate that it is used as
+ * the semun union member 'buf' as the fourth argment to semctl() when the
+ * third argument is IPC_STAT or IPC_SET.
+ *
+ * Note: only the fields sem_perm, sem_nsems, sem_otime, and sem_ctime
+ * are meaningful in user space.
+ */
+#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
+struct semid_ds
+#else
+#define semid_ds __semid_ds_new
+struct __semid_ds_new
+#endif
+{
+ struct __ipc_perm_new sem_perm; /* [XSI] operation permission struct */
+ __int32_t sem_base; /* 32 bit base ptr for semaphore set */
+ unsigned short sem_nsems; /* [XSI] number of sems in set */
+ time_t sem_otime; /* [XSI] last operation time */
+ __int32_t sem_pad1; /* RESERVED: DO NOT USE! */
+ time_t sem_ctime; /* [XSI] last change time */
+ /* Times measured in secs since */
+ /* 00:00:00 GMT, Jan. 1, 1970 */
+ __int32_t sem_pad2; /* RESERVED: DO NOT USE! */
+ __int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */